Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
Firefox 123
Linux
Desktop
6 months ago
Test name Executions per second
floor 190665024.0 Ops/sec
~~ 198589056.0 Ops/sec
>> 0 202460272.0 Ops/sec
| 0 204908832.0 Ops/sec
<< 0 206513488.0 Ops/sec
& 0xFFFFFFFFFFFF 204877088.0 Ops/sec
^ 0x000000000000 207670960.0 Ops/sec
Math.trunc() 208869072.0 Ops/sec
x - (x % 1) 999285440.0 Ops/sec
parseInt() 217084768.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()