diff options
author | Connor Abbott <[email protected]> | 2019-05-20 14:58:06 +0200 |
---|---|---|
committer | Connor Abbott <[email protected]> | 2019-05-31 19:14:04 +0200 |
commit | f7ff6856492e8437ad78bb6a853a681afd3fc98c (patch) | |
tree | 496d0522d8b9e68fefb53fd3e0159dd5c57c3b36 /src/util/build_id.c | |
parent | 3bd073301182b4bb2dae28bee6175ebe78184f3d (diff) |
util/set: Pull out loop-invariant computations
Unfortunately GCC can't do this for us, probably because we call the key
comparison function which GCC can't prove won't modify arbitrary memory.
This is a pretty hot function, so do the optimization manually to be
sure the compiler will get it right.
While we're here, make the computation of the new probe address use a
single conditional subtract instead of a modulo, since we know that it
won't ever get as big as 2 * ht->size before the modulo. Modulos tend to
be pretty expensive operations.
shader-db compile time results for my database:
Difference at 95.0% confidence
-2.24934 +/- 0.69897
-0.516296% +/- 0.159993%
(Student's t, pooled s = 0.983684)
Reviewed-by: Eric Anholt <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/util/build_id.c')
0 files changed, 0 insertions, 0 deletions