Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
floor 3931090.0 Ops/sec
~~ 7701561.0 Ops/sec
>> 0 7712006.0 Ops/sec
| 0 7731379.5 Ops/sec
<< 0 7742729.0 Ops/sec
& 0xFFFFFFFFFFFF 7756769.0 Ops/sec
^ 0x000000000000 7786322.0 Ops/sec
Math.trunc() 3945656.5 Ops/sec
x - (x % 1) 5296835.0 Ops/sec
parseInt() 4185559.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()