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 5018476.5 Ops/sec
~~ 9198108.0 Ops/sec
>> 0 9221696.0 Ops/sec
| 0 9215568.0 Ops/sec
<< 0 9224933.0 Ops/sec
& 0xFFFFFFFFFFFF 9228924.0 Ops/sec
^ 0x000000000000 9222244.0 Ops/sec
Math.trunc() 5026335.5 Ops/sec
x - (x % 1) 6239001.0 Ops/sec
parseInt() 4996977.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()