selinux/libsepol
Christian Göttsche 08be63572e libsepol/cil: use DJB2a string hash function
The hash table implementation uses `& (h->size - 1)` to truncate
generated hashes to the number of buckets.  This operation is equal to
`% h->size` if and only if the size is a power of two (which seems to be
always the case).  One property of the binary and with a power of two
(and probably a small one <=2048) is all higher bits are discarded.
Thus a hash function is needed with a good avalanche effect, which the
current one is not.

Benchmark of building dssp5:

    # Current
    Time (mean ± σ):      1.347 s ±  0.065 s    [User: 1.207 s, System: 0.138 s]
    Range (min … max):    1.274 s …  1.436 s    10 runs

    # Patch
    Time (mean ± σ):      1.336 s ±  0.029 s    [User: 1.195 s, System: 0.140 s]
    Range (min … max):    1.303 s …  1.376 s    10 runs

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
2023-11-21 08:55:40 -05:00
..
cil libsepol/cil: use DJB2a string hash function 2023-11-21 08:55:40 -05:00
fuzz
include libsepol: Changes to ebitmap.h to fix compiler warnings 2023-08-16 13:33:48 -04:00
man Do not automatically install Russian translations 2023-08-16 13:33:47 -04:00
src libsepol: use DJB2a string hash function 2023-11-21 08:55:39 -05:00
tests
utils
.gitignore
LICENSE
Makefile
VERSION Update VERSIONs to 3.6-rc1 for release. 2023-11-08 12:51:35 +01:00