Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0
Firefox 118
Ubuntu
Desktop
one year ago
Test name Executions per second
floor 193061840.0 Ops/sec
~~ 196643024.0 Ops/sec
>> 0 202747904.0 Ops/sec
| 0 197310208.0 Ops/sec
<< 0 194316032.0 Ops/sec
& 0xFFFFFFFFFFFF 195474144.0 Ops/sec
^ 0x000000000000 197869200.0 Ops/sec
Math.trunc() 204901040.0 Ops/sec
x - (x % 1) 339901792.0 Ops/sec
parseInt() 200964256.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()