Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.41 Safari/537.36
Chrome 88
Windows
Desktop
4 years ago
Test name Executions per second
floor 2105932.8 Ops/sec
~~ 3860545.0 Ops/sec
>> 0 3298589.2 Ops/sec
| 0 3269380.0 Ops/sec
<< 0 3219333.5 Ops/sec
& 0xFFFFFFFFFFFF 3229996.8 Ops/sec
^ 0x000000000000 3196879.8 Ops/sec
Math.trunc() 1728232.2 Ops/sec
x - (x % 1) 2368679.0 Ops/sec
parseInt() 1950682.6 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()