samchon/tstl

Improve performance of HashBuckets using bit operation

samchon opened this issue · 0 comments

Change the hash buckets not to using the mod (%) operator but the bitwise and (&) operator . If size of the hash buckets always be multiple of 2, the ^ operation can replace the % operation and it can reduce elapsed time about 10 percent.

Modulo and Division vs Bitwise Operations

https://mziccard.me/2015/05/08/modulo-and-division-vs-bitwise-operations/