Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Chrome 90
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
floor 3426286.8 Ops/sec
~~ 6620299.5 Ops/sec
>> 0 6613549.0 Ops/sec
| 0 6562341.0 Ops/sec
<< 0 6616123.5 Ops/sec
& 0xFFFFFFFFFFFF 6810854.5 Ops/sec
^ 0x000000000000 6734062.0 Ops/sec
Math.trunc() 3488318.5 Ops/sec
x - (x % 1) 4519220.5 Ops/sec
parseInt() 3435776.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()