Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111
Linux
Desktop
one year ago
Test name Executions per second
floor 5414888.5 Ops/sec
~~ 10468647.0 Ops/sec
>> 0 10475963.0 Ops/sec
| 0 10475121.0 Ops/sec
<< 0 10471265.0 Ops/sec
& 0xFFFFFFFFFFFF 10624242.0 Ops/sec
^ 0x000000000000 10492098.0 Ops/sec
Math.trunc() 5439562.0 Ops/sec
x - (x % 1) 6556503.5 Ops/sec
parseInt() 5328947.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()