Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15
Safari 16
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
floor 3273612.2 Ops/sec
~~ 5237974.0 Ops/sec
>> 0 5289129.0 Ops/sec
| 0 5241402.5 Ops/sec
<< 0 5099488.0 Ops/sec
& 0xFFFFFFFFFFFF 5106153.5 Ops/sec
^ 0x000000000000 5063567.5 Ops/sec
Math.trunc() 3145553.0 Ops/sec
x - (x % 1) 3300100.8 Ops/sec
parseInt() 2832350.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()