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; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
Math.sqrt
7274.3 Ops/sec
sqrt with Math.pow
7069.5 Ops/sec
sqrt with ** 0.5
8959.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)