Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1
Mobile Safari 14
iOS 14.4.2
Mobile
3 years ago
Test name Executions per second
floor 5525310.0 Ops/sec
~~ 8543164.0 Ops/sec
>> 0 8463518.0 Ops/sec
| 0 8239861.0 Ops/sec
<< 0 8109767.5 Ops/sec
& 0xFFFFFFFFFFFF 8046047.5 Ops/sec
^ 0x000000000000 8039978.0 Ops/sec
Math.trunc() 4932540.5 Ops/sec
x - (x % 1) 4762514.0 Ops/sec
parseInt() 3412963.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()