Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Chrome 88
Mac OS X 10.15.6
Desktop
3 years ago
Test name Executions per second
floor 1831423.0 Ops/sec
~~ 2938933.2 Ops/sec
>> 0 2956219.8 Ops/sec
| 0 3004088.0 Ops/sec
<< 0 2947461.0 Ops/sec
& 0xFFFFFFFFFFFF 2948647.5 Ops/sec
^ 0x000000000000 2945640.2 Ops/sec
Math.trunc() 1754974.6 Ops/sec
x - (x % 1) 2135259.8 Ops/sec
parseInt() 2021596.4 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()