<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Adler32 Hash; clang 5.0 is 1.3x slower than gcc 7.2"
href="https://bugs.llvm.org/show_bug.cgi?id=35567">35567</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Adler32 Hash; clang 5.0 is 1.3x slower than gcc 7.2
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nigeltao@golang.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19528" name="attach_19528" title="Adler32 C implementation">attachment 19528</a> <a href="attachment.cgi?id=19528&action=edit" title="Adler32 C implementation">[details]</a></span>
Adler32 C implementation
adler32-standalone.c (attached, also at
<a href="https://github.com/google/wuffs/blob/master/script/adler32-standalone.c">https://github.com/google/wuffs/blob/master/script/adler32-standalone.c</a>) is
some straight C code to calculate the standard Adler32 hash, used by the zlib
format.
Measuring throughput on a recent Debian Testing system (clang 5.0 and gcc 7.2),
Intel x86_64 Broadwell, suggests that clang's generated code is 1.3x slower.
$ clang-5.0 -O3 adler32-standalone.c; ./a.out
2311 MiB/s, clang 5.0.0 (tags/RELEASE_500/rc2)
$ gcc -O3 adler32-standalone.c; ./a.out
3052 MiB/s, gcc 7.2.1 20171025
The core loop (manually unrolled 8 times) is:
while (p < end0) {
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
s1 += ((uint32_t)(*p));
s2 += s1;
p++;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>