Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
abs vs ** 2 vs math.pow
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
abs
449.0 Ops/sec
pow
462.4 Ops/sec
** 2
463.2 Ops/sec
Script Preparation code:
const arr = Array.from({ length: 100_000 }, () => (Math.random()));
Tests:
abs
var b = arr.map((num) => Math.abs(num));
pow
var b = arr.map((num) => Math.pow(num, 2));
** 2
var b = arr.map((num) => num ** 2);