![]() xdl_hash_record_verbatim uses modified djb2 hash with XOR instead of ADD
for combining. The ADD-based variant is used as the basis of the modern
("GNU") symbol lookup scheme in ELF. Glibc dynamic loader received an
optimized version of this hash function thanks to Noah Goldstein [1].
Switch xdl_hash_record_verbatim to additive hashing and implement
an optimized loop following the scheme suggested by Noah.
Timing 'git log --oneline --shortstat v2.0.0..v2.5.0' under perf, I got
version | cycles, bn | instructions, bn
---------------------------------------
A 6.38 11.3
B 6.21 10.89
C 5.80 9.95
D 5.83 8.74
---------------------------------------
A: baseline (git master at
|
||
---|---|---|
.. | ||
xdiff.h | ||
xdiffi.c | ||
xdiffi.h | ||
xemit.c | ||
xemit.h | ||
xhistogram.c | ||
xinclude.h | ||
xmacros.h | ||
xmerge.c | ||
xpatience.c | ||
xprepare.c | ||
xprepare.h | ||
xtypes.h | ||
xutils.c | ||
xutils.h |