Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
floor 3675608.8 Ops/sec
~~ 6741812.0 Ops/sec
>> 0 6642500.0 Ops/sec
| 0 6124002.5 Ops/sec
<< 0 6365588.5 Ops/sec
& 0xFFFFFFFFFFFF 6882556.5 Ops/sec
^ 0x000000000000 6817794.0 Ops/sec
Math.trunc() 3729676.2 Ops/sec
x - (x % 1) 4706684.0 Ops/sec
parseInt() 3698343.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()