Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2939.0 Safari/537.36
Chrome 57
Windows
Other
8 years ago
Test name Executions per second
floor 1681094.1 Ops/sec
~~ 2877398.2 Ops/sec
>> 0 2902853.8 Ops/sec
| 0 2880751.8 Ops/sec
<< 0 2877345.2 Ops/sec
& 0xFFFFFFFFFFFF 2849634.5 Ops/sec
^ 0x000000000000 2898072.5 Ops/sec
Math.trunc() 1672430.6 Ops/sec
x - (x % 1) 1962940.5 Ops/sec
parseInt() 1696949.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()