Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
HypotMap vs SqrtReduce
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/151.0.0.0 Safari/537.36 Edg/151.0.0.0
Browser:
Chrome 151
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one month ago
Benchmark engine:
Benchmark.js
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
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]);