Hamming Weight |
|
Benchmark tests of various ways to calculate it are in [hamming_weight_test.lua]:
Lua 5.2.0/bit32, Intel Xeon, 2012-03-22 hw_simple: 5.9E-06 5.9E-06 5.9E-06 s hw_dc2bit: 1.7E-06 1.7E-06 1.7E-06 s hw_dc3bit: 1.5E-06 1.5E-06 1.5E-06 s hw_dc4bit: 1.8E-06 1.8E-06 1.8E-06 s hw_dci: 1.7E-06 1.7E-06 1.7E-06 s hw_lut8: 1.2E-06 1.2E-06 1.2E-06 s hw_lut8a: 5.4E-07 5.4E-07 5.3E-07 s hw_wegner: 2.9E-06 2.9E-06 2.9E-06 s LuaJIT 2.x/bit git2012-03-17, Intel Xeon, 2012-03-22 hw_simple: 6.9E-08 6.9E-08 6.9E-08 s hw_dc2bit: 1.9E-09 1.9E-09 1.9E-09 s hw_dc3bit: 1.8E-09 1.8E-09 1.8E-09 s hw_dc4bit: 2.0E-09 2.0E-09 2.0E-09 s hw_dci: 1.8E-09 1.8E-09 1.8E-09 s hw_lut8: 1.7E-09 1.7E-09 1.7E-09 s hw_lut8a: 8.2E-09 8.2E-09 8.2E-09 s hw_wegner: 6.0E-08 5.9E-08 5.9E-08 s (smaller is better)