Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 OPR/41.0.2353.69
Opera 41
Windows
Other
8 years ago
Test name Executions per second
floor 1791621.9 Ops/sec
~~ 3323767.5 Ops/sec
>> 0 3273829.2 Ops/sec
| 0 3150303.0 Ops/sec
<< 0 3100909.2 Ops/sec
& 0xFFFFFFFFFFFF 3137727.2 Ops/sec
^ 0x000000000000 3287037.5 Ops/sec
Math.trunc() 1694126.1 Ops/sec
x - (x % 1) 2200330.0 Ops/sec
parseInt() 1766908.1 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()