Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
unique_array_reduce
(version: 3)
Comparing performance of:
reduce vs unify
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let groups = []; for (let i = 0, lengthI = 10000; i < lengthI; ++i) { const group = []; for (let j = 0, lengthJ = 10000; j < lengthJ; ++j) { group.push(j % 2 ? 'a' : 'b'); } groups.push(group); }
Tests:
reduce
Array.from(groups.reduce((set, group) => { group.forEach(value => set.add(value)); return set; }, new Set()));
unify
const mySet = new Set(); groups.forEach(group => group.forEach(value => mySet.add(value))); return Array.from(mySet);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
reduce
unify
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser/OS:
Chrome 142 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
reduce
3.1 Ops/sec
unify
3.0 Ops/sec
Related benchmarks:
Asynchronous For-Loop
For i / For of / ForEach
ForOfFor
array vs []
TestArrayAllocationv2
Test adding into array
Array population
Set replace
12132132132131243214124
Comments
Confirm delete:
Do you really want to delete benchmark?