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 4350771.5 Ops/sec
~~ 8122242.0 Ops/sec
>> 0 8147992.5 Ops/sec
| 0 8135857.5 Ops/sec
<< 0 8134232.5 Ops/sec
& 0xFFFFFFFFFFFF 8151839.0 Ops/sec
^ 0x000000000000 8123199.5 Ops/sec
Math.trunc() 4348179.0 Ops/sec
x - (x % 1) 5497074.0 Ops/sec
parseInt() 4281024.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()