Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
Firefox 114
Windows
Desktop
one year ago
Test name Executions per second
floor 203459040.0 Ops/sec
~~ 203619936.0 Ops/sec
>> 0 203401168.0 Ops/sec
| 0 201503504.0 Ops/sec
<< 0 203643152.0 Ops/sec
& 0xFFFFFFFFFFFF 203722336.0 Ops/sec
^ 0x000000000000 203156560.0 Ops/sec
Math.trunc() 203174400.0 Ops/sec
x - (x % 1) 426616224.0 Ops/sec
parseInt() 203054448.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()