Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
Chrome 83
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
floor 2980426.8 Ops/sec
~~ 5536521.5 Ops/sec
>> 0 5755026.5 Ops/sec
| 0 5772503.0 Ops/sec
<< 0 5795009.0 Ops/sec
& 0xFFFFFFFFFFFF 5738402.5 Ops/sec
^ 0x000000000000 5605918.5 Ops/sec
Math.trunc() 3024612.2 Ops/sec
x - (x % 1) 3919413.0 Ops/sec
parseInt() 3092667.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()