Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36
Chrome 96
Windows
Desktop
3 years ago
Test name Executions per second
floor 3073023.2 Ops/sec
~~ 5766463.5 Ops/sec
>> 0 5759825.0 Ops/sec
| 0 5849605.5 Ops/sec
<< 0 5941052.5 Ops/sec
& 0xFFFFFFFFFFFF 6002974.0 Ops/sec
^ 0x000000000000 5906071.0 Ops/sec
Math.trunc() 2839154.2 Ops/sec
x - (x % 1) 3979688.8 Ops/sec
parseInt() 3290429.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()