Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Chrome 96
Windows
Desktop
3 years ago
Test name Executions per second
floor 3051823.2 Ops/sec
~~ 5325975.0 Ops/sec
>> 0 5521977.0 Ops/sec
| 0 5379613.5 Ops/sec
<< 0 5291724.0 Ops/sec
& 0xFFFFFFFFFFFF 5572472.0 Ops/sec
^ 0x000000000000 5399949.0 Ops/sec
Math.trunc() 3117000.2 Ops/sec
x - (x % 1) 3530646.5 Ops/sec
parseInt() 3121311.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()