Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
d3 max on array from vs d3 max twice
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
d3 max on array
29.7 Ops/sec
d3 max twice
166.4 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/4.13.0/d3.min.js'></script>
Script Preparation code:
function getRandomInt(max) { return Math.floor(Math.random() * max); } var days = ['Sun', 'Mon', 'Tue', 'Wed','Thu', 'Fri', 'Sat']; var data = [...Array(1000)].map(_ => ({day: days[getRandomInt(7)], values: (new Float64Array(1000)).map(_ => getRandomInt(1000))}));
Tests:
d3 max on array
d3.max(data.flatMap(d => Array.from(d.values)));
d3 max twice
d3.max(data.map(d => d3.max(d.values)));