<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63750>63750</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld] xxHash performance - XXH_X64 vs XXH3_X64
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
lld,
performance
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PiotrZSL
</td>
</tr>
</table>
<pre>
Currently for hashing (symbol names, ...) in lld we use llvm::xxHash64 that utilize https://github.com/Cyan4973/xxHash implementation.
In 2020 Yann Collet released stable version of XXH3 algorithm, and in 2021 it included additional performance optimizations.
This algorithm is described as:
`XXH3 (since v0.8.0): generates 64 or 128-bit hashes, using vectorized arithmetic.`
When linking debug version on clang binary on single thread we get:
```
Time (mean ± σ): 7.715 s ± 0.143 s [User: 5.685 s, System: 1.782 s]
Range (min … max): 7.532 s … 8.375 s 50 runs
```
And xxHash64 according to perf takes around ~6.81%
When using XXH3_64 we get:
```
Time (mean ± σ): 7.429 s ± 0.157 s [User: 5.384 s, System: 1.810 s]
Range (min … max): 7.256 s … 8.247 s 50 runs
```
and hash function according to perf takes ~1.32%.
This mean that there is +- cheap way to gain 4-5%.
Maybe it's time to switch ?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslM9u4zYQxp-GvgwsUENRfw46OE6NLdACRXeLpr0sKGkssUuRBkklcQ777AXlNM422xYF1jBsyyS_mfnN8FMh6NEStUzeMHm7UUucnG9_0i7639__sOnccG73i_dkoznD0XmYVJi0HYFhHc5z5wxYNVNguIcsyxg2oC0YM8ADwRIIjLmfmdgxsXt8fKfCVBYQJxVhidroJ4IpxlNIG_DA8DDqOC1d1ruZ4WF_VrZoKsHwcDkLej4ZmslGFbWzGeO3jO--t4AcOfymrIW9M4YieDKkAg0QouoMwT35oJ0Fd4S7u3cClBmd13GaU97KDilp5JiDjqBtb5aBBlDDoFMcZeBE_u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