Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
Chrome 92
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
floor 3604173.8 Ops/sec
~~ 6698388.5 Ops/sec
>> 0 6523613.0 Ops/sec
| 0 6315536.0 Ops/sec
<< 0 6735773.0 Ops/sec
& 0xFFFFFFFFFFFF 6730378.5 Ops/sec
^ 0x000000000000 6728061.5 Ops/sec
Math.trunc() 3592433.0 Ops/sec
x - (x % 1) 4568535.0 Ops/sec
parseInt() 3607880.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()