Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Windows 8.1
Desktop
3 years ago
Test name Executions per second
floor 2438778.0 Ops/sec
~~ 4310600.5 Ops/sec
>> 0 4289705.0 Ops/sec
| 0 4278965.5 Ops/sec
<< 0 4297216.0 Ops/sec
& 0xFFFFFFFFFFFF 4241219.5 Ops/sec
^ 0x000000000000 4230115.5 Ops/sec
Math.trunc() 2383607.2 Ops/sec
x - (x % 1) 2879685.0 Ops/sec
parseInt() 2396284.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()