htable: avoid branch in calculating perfect bit.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 2 Apr 2019 01:19:28 +0000 (11:49 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 2 Apr 2019 01:19:28 +0000 (11:49 +1030)
commit7623d0829a63e7f95ed6f116b7e9f2f4a023e8e7
tree0029cd252554ef0d85f801d5ab80b06cee94a1a6
parentd615e534e870a911f11b7b88021242220ea053bf
htable: avoid branch in calculating perfect bit.

Final results of tools/speed/10000000 (10 runs) shows a slight
slowdown in some tests, but it makes an empty htable smaller.

-Initial delete all: 96-98(96.4+/-0.66) ns
+Initial delete all: 97-99(98.2+/-0.75) ns
-Initial re-inserting: 117-124(121.4+/-1.9) ns
+Initial re-inserting: 124-131(126.4+/-2.4) ns
-Adding (a different) half: 49-50(49.3+/-0.46) ns
+Adding (a different) half: 50-52(51.2+/-0.75) ns

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/htable/htable.c