Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97
Windows
Desktop
2 years ago
Test name Executions per second
floor 1825219.0 Ops/sec
~~ 3247100.0 Ops/sec
>> 0 3027502.2 Ops/sec
| 0 3143360.8 Ops/sec
<< 0 3328144.5 Ops/sec
& 0xFFFFFFFFFFFF 3233457.8 Ops/sec
^ 0x000000000000 3098913.0 Ops/sec
Math.trunc() 1743334.9 Ops/sec
x - (x % 1) 2237389.0 Ops/sec
parseInt() 1838799.1 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()