Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.41
Chrome 114
Windows
Desktop
one year ago
Test name Executions per second
floor 6990852.5 Ops/sec
~~ 13029796.0 Ops/sec
>> 0 13018904.0 Ops/sec
| 0 13051845.0 Ops/sec
<< 0 13098371.0 Ops/sec
& 0xFFFFFFFFFFFF 13026726.0 Ops/sec
^ 0x000000000000 12669053.0 Ops/sec
Math.trunc() 6779731.0 Ops/sec
x - (x % 1) 8280633.5 Ops/sec
parseInt() 6704164.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()