Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Windows
Desktop
3 years ago
Test name Executions per second
floor 1618412.1 Ops/sec
~~ 2879357.5 Ops/sec
>> 0 2745168.2 Ops/sec
| 0 2608763.0 Ops/sec
<< 0 2303812.5 Ops/sec
& 0xFFFFFFFFFFFF 2142747.8 Ops/sec
^ 0x000000000000 2013456.5 Ops/sec
Math.trunc() 1475446.4 Ops/sec
x - (x % 1) 2188608.8 Ops/sec
parseInt() 1673928.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()