Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0
Chrome 129
Windows
Desktop
2 months ago
Test name Executions per second
floor 3257496.2 Ops/sec
~~ 5460391.5 Ops/sec
>> 0 5321150.0 Ops/sec
| 0 5507039.0 Ops/sec
<< 0 5439588.0 Ops/sec
& 0xFFFFFFFFFFFF 5401547.0 Ops/sec
^ 0x000000000000 5487752.5 Ops/sec
Math.trunc() 3231120.8 Ops/sec
x - (x % 1) 3377547.5 Ops/sec
parseInt() 3194595.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()