Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
floor 3151025.0 Ops/sec
~~ 5908300.5 Ops/sec
>> 0 5791523.5 Ops/sec
| 0 5947293.5 Ops/sec
<< 0 6032844.5 Ops/sec
& 0xFFFFFFFFFFFF 5797352.5 Ops/sec
^ 0x000000000000 5809523.5 Ops/sec
Math.trunc() 3160923.0 Ops/sec
x - (x % 1) 3917433.0 Ops/sec
parseInt() 3037740.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()