Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
Chrome 88
Windows 7
Desktop
3 years ago
Test name Executions per second
floor 2550005.2 Ops/sec
~~ 4746285.5 Ops/sec
>> 0 4725003.5 Ops/sec
| 0 4720796.0 Ops/sec
<< 0 4746327.0 Ops/sec
& 0xFFFFFFFFFFFF 4734449.5 Ops/sec
^ 0x000000000000 4722660.5 Ops/sec
Math.trunc() 2554346.5 Ops/sec
x - (x % 1) 3260045.8 Ops/sec
parseInt() 2592797.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()