Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
floor 2593846.5 Ops/sec
~~ 4461636.0 Ops/sec
>> 0 4689982.5 Ops/sec
| 0 4707249.0 Ops/sec
<< 0 4697726.5 Ops/sec
& 0xFFFFFFFFFFFF 4690409.5 Ops/sec
^ 0x000000000000 4681866.0 Ops/sec
Math.trunc() 2639175.0 Ops/sec
x - (x % 1) 3220665.2 Ops/sec
parseInt() 2602676.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()