Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
Chrome 51
Windows
Other
8 years ago
Test name Executions per second
floor 11503856.0 Ops/sec
~~ 39927212.0 Ops/sec
>> 0 55236184.0 Ops/sec
| 0 53615408.0 Ops/sec
<< 0 53706032.0 Ops/sec
& 0xFFFFFFFFFFFF 52860172.0 Ops/sec
^ 0x000000000000 52163880.0 Ops/sec
Math.trunc() 10284334.0 Ops/sec
x - (x % 1) 15450723.0 Ops/sec
parseInt() 12933779.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()