Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
floor 3182675.5 Ops/sec
~~ 6031162.5 Ops/sec
>> 0 5995604.5 Ops/sec
| 0 6006394.0 Ops/sec
<< 0 6034550.5 Ops/sec
& 0xFFFFFFFFFFFF 6011509.0 Ops/sec
^ 0x000000000000 6028905.5 Ops/sec
Math.trunc() 3194332.8 Ops/sec
x - (x % 1) 4131008.2 Ops/sec
parseInt() 3302539.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()