Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Chrome 103
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
floor 2830963.8 Ops/sec
~~ 6984928.5 Ops/sec
>> 0 6770755.0 Ops/sec
| 0 6648796.5 Ops/sec
<< 0 6938372.0 Ops/sec
& 0xFFFFFFFFFFFF 6963347.5 Ops/sec
^ 0x000000000000 6762582.0 Ops/sec
Math.trunc() 3501906.8 Ops/sec
x - (x % 1) 4595391.5 Ops/sec
parseInt() 2857945.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()