Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
Chrome 86
Linux
Desktop
4 years ago
Test name Executions per second
floor 1961330.0 Ops/sec
~~ 3645473.2 Ops/sec
>> 0 3684894.5 Ops/sec
| 0 3680844.8 Ops/sec
<< 0 3686795.0 Ops/sec
& 0xFFFFFFFFFFFF 3690291.5 Ops/sec
^ 0x000000000000 3692249.0 Ops/sec
Math.trunc() 2072483.5 Ops/sec
x - (x % 1) 2523586.0 Ops/sec
parseInt() 2043197.9 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()