Script Preparation code:
Tests:

Historical Performance Data aggregated from 26 community runs

Desktop Results:
Chrome 26 runs
abs function
14.9M/s
compare
14.9M/s
Math.abs access
10.6M/s
bitshift
10.1M/s

Fastest: abs function (1.5x faster)

View exact numbers
  • abs function: 14,933,258 ops/sec
  • compare: 14,894,990 ops/sec
  • Math.abs access: 10,616,576 ops/sec
  • bitshift: 10,097,154 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Math.abs access
    abs function
    compare
    bitshift

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36 Edg/151.0.0.0
Chrome 151 on Windows
View result in a separate tab
Math.abs access
1064.7M/s
abs function
1062.8M/s
bitshift
1062.2M/s
compare
1052.0M/s
View exact numbers
Test name Executions per second
Math.abs access 1,064,704,896 Ops/sec
abs function 1,062,810,240 Ops/sec
bitshift 1,062,197,504 Ops/sec
compare 1,051,950,080 Ops/sec