Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Chrome 118
Windows
Desktop
one year ago
Test name Executions per second
floor 1255183.9 Ops/sec
~~ 2189653.5 Ops/sec
>> 0 2236932.0 Ops/sec
| 0 2255410.0 Ops/sec
<< 0 2271764.5 Ops/sec
& 0xFFFFFFFFFFFF 2259388.8 Ops/sec
^ 0x000000000000 2267800.8 Ops/sec
Math.trunc() 1326916.1 Ops/sec
x - (x % 1) 1568257.2 Ops/sec
parseInt() 1319618.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()