Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Firefox 78
Linux
Desktop
3 years ago
Test name Executions per second
floor 7255057.5 Ops/sec
~~ 7871851.5 Ops/sec
>> 0 8449469.0 Ops/sec
| 0 8906391.0 Ops/sec
<< 0 8705935.0 Ops/sec
& 0xFFFFFFFFFFFF 8747005.0 Ops/sec
^ 0x000000000000 8922113.0 Ops/sec
Math.trunc() 6467416.0 Ops/sec
x - (x % 1) 6305004.0 Ops/sec
parseInt() 6755281.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()