Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.685 (beta) Yowser/2.5 Safari/537.36
Yandex Browser 23
Linux
Desktop
one year ago
Test name Executions per second
floor 3462175.0 Ops/sec
~~ 6777342.0 Ops/sec
>> 0 6859033.5 Ops/sec
| 0 6893160.0 Ops/sec
<< 0 6709623.0 Ops/sec
& 0xFFFFFFFFFFFF 6875296.0 Ops/sec
^ 0x000000000000 6892655.5 Ops/sec
Math.trunc() 3479893.0 Ops/sec
x - (x % 1) 4481523.0 Ops/sec
parseInt() 3446801.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()