Skip to content

[lld] xxHash performance - XXH_X64 vs XXH3_X64 #63750

@PiotrZSL

Description

@PiotrZSL

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 ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions