Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Math.pow(x,0.5) vs Math.sqrt(x) vs (x ** 0.5) reduce sum
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/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Math.sqrt
207.9 Ops/sec
sqrt with Math.pow
193.1 Ops/sec
sqrt with ** 0.5
806.1 Ops/sec
Script Preparation code:
var numbers = Array.from(Array(10000), (_,x) => (Math.random()*x));
Tests:
Math.sqrt
const sum = numbers.map(number => Math.sqrt(number)).reduce((a, b) => a + b, 0) console.log(sum)
sqrt with Math.pow
const sum = numbers.map(number => Math.pow(number, 0.5)).reduce((a, b) => a + b, 0) console.log(sum)
sqrt with ** 0.5
const sum = numbers.map(number => number ** 0.5).reduce((a, b) => a + b, 0) console.log(sum)