Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
floor 2388933.2 Ops/sec
~~ 4225113.0 Ops/sec
>> 0 4185666.5 Ops/sec
| 0 4018711.0 Ops/sec
<< 0 4011882.0 Ops/sec
& 0xFFFFFFFFFFFF 4015862.2 Ops/sec
^ 0x000000000000 4253795.0 Ops/sec
Math.trunc() 2421015.2 Ops/sec
x - (x % 1) 2728235.2 Ops/sec
parseInt() 2412471.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()