Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
HypotMap vs SqrtReduce
(version: 1)
Benchmark.js
Comparing performance of:
Rest vs Array
Created:
one month ago
by:
Guest
Go to the latest result
Script Preparation code:
const f1 = (a, b) => Math.hypot(...a.map((x, i) => x - b[i])); const f2 = (a, b) => Math.sqrt(a.reduce((sum, x, i) => { const delta = x - b[i]; return sum + delta * delta; }, 0));
Tests:
Rest
const r1 = f1([6, 7, 8, 9, 0], [0, 1, 2, 3, 4, 5]);
Array
const r2 = f2([6, 7, 8, 9, 0], [0, 1, 2, 3, 4, 5]);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Rest
Array
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
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
Browser/OS:
Chrome 151 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Array
212.2M/s
Rest
12.2M/s
View exact numbers
Test name
Executions per second
✓
Array
212,188,448 Ops/sec
Rest
12,225,654 Ops/sec
Related benchmarks
hypot vs sqrt
Math.hypot vs Math.sqrt
Math.pow(x,0.5) vs Math.sqrt(x) vs (x ** 0.5) sum in for of loop
Math.pow(x,0.5) vs Math.sqrt(x) vs (x ** 0.5) reduce sum
Math.hypot vs Math.sqrt vs Math.sqrt&pow vs Math.sqrt&**2
sqrt vs hypot
Comments
Confirm delete:
Do you really want to delete benchmark?