Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
Chrome 66
Linux
Desktop
2 years ago
Test name Executions per second
floor 2514599.2 Ops/sec
~~ 5468534.0 Ops/sec
>> 0 5480152.5 Ops/sec
| 0 5457149.0 Ops/sec
<< 0 5456598.5 Ops/sec
& 0xFFFFFFFFFFFF 5492875.5 Ops/sec
^ 0x000000000000 5494913.0 Ops/sec
Math.trunc() 2539367.2 Ops/sec
x - (x % 1) 3710847.0 Ops/sec
parseInt() 2582129.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()