Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15
Safari 14
Mac OS X 10.15.6
Desktop
3 years ago
Test name Executions per second
floor 2219855.5 Ops/sec
~~ 3629946.2 Ops/sec
>> 0 3777902.2 Ops/sec
| 0 3812087.8 Ops/sec
<< 0 3835182.8 Ops/sec
& 0xFFFFFFFFFFFF 3895158.2 Ops/sec
^ 0x000000000000 3874015.0 Ops/sec
Math.trunc() 2289812.0 Ops/sec
x - (x % 1) 2457797.2 Ops/sec
parseInt() 2035740.9 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()