Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15
Safari 14
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
floor 3362088.8 Ops/sec
~~ 5972992.5 Ops/sec
>> 0 5994234.0 Ops/sec
| 0 6019360.0 Ops/sec
<< 0 5970299.5 Ops/sec
& 0xFFFFFFFFFFFF 5938260.5 Ops/sec
^ 0x000000000000 6051257.5 Ops/sec
Math.trunc() 3620122.0 Ops/sec
x - (x % 1) 3752229.8 Ops/sec
parseInt() 3061455.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()


;