Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Chrome 118
Linux
Desktop
one year ago
Test name Executions per second
floor 4711858.0 Ops/sec
~~ 8291680.0 Ops/sec
>> 0 8296987.0 Ops/sec
| 0 8351748.0 Ops/sec
<< 0 8365547.5 Ops/sec
& 0xFFFFFFFFFFFF 8315588.5 Ops/sec
^ 0x000000000000 8339199.0 Ops/sec
Math.trunc() 4687627.0 Ops/sec
x - (x % 1) 5421730.5 Ops/sec
parseInt() 4479253.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()