tstl icon indicating copy to clipboard operation
tstl copied to clipboard

Improve performance of HashBuckets using bit operation

Open samchon opened this issue 3 years ago • 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/

samchon avatar Dec 19 '20 14:12 samchon