Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132
Mac OS X 10.15.7
Desktop
3 months ago
Test name Executions per second
Math.abs access 153945616.0 Ops/sec
abs function 0.0 Ops/sec
compare 111615520.0 Ops/sec
Script Preparation code:
AخA
 
var x = -200000
var abs = Math.sign
Tests:
  • Math.abs access

     
    Math.sign(x)
  • abs function

     
    sign(x)
  • compare

     
    x < 0 ? -1 : x > 0 ? 1 : 0