Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Chrome 113
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
floor 4105366.2 Ops/sec
~~ 7575880.0 Ops/sec
>> 0 7567064.5 Ops/sec
| 0 7493494.5 Ops/sec
<< 0 7482842.5 Ops/sec
& 0xFFFFFFFFFFFF 7547102.5 Ops/sec
^ 0x000000000000 7516143.5 Ops/sec
Math.trunc() 4077427.2 Ops/sec
x - (x % 1) 5065991.0 Ops/sec
parseInt() 4069000.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()