Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15
Safari 14
Mac OS X 10.14.6
Desktop
3 years ago
Test name Executions per second
floor 1558234.6 Ops/sec
~~ 2865449.5 Ops/sec
>> 0 2871572.8 Ops/sec
| 0 2822001.8 Ops/sec
<< 0 2869535.8 Ops/sec
& 0xFFFFFFFFFFFF 2900417.0 Ops/sec
^ 0x000000000000 2844461.0 Ops/sec
Math.trunc() 1632465.8 Ops/sec
x - (x % 1) 1789863.2 Ops/sec
parseInt() 1446642.4 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()