Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set.union vs Set.add
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36 EdgA/144.0.0.0
Browser:
Chrome Mobile 144
Operating system:
Android
Device Platform:
Mobile
Date tested:
7 days ago
Test name
Executions per second
Set.union
232700.7 Ops/sec
Set.add
124082.5 Ops/sec
Set.union in the other order
620510.9 Ops/sec
Set.add in the other order
165674.2 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const setA = new Set(Array.from({ length: 10000 }, _ => Math.floor(Math.random() * 200))); const setB = new Set(Array.from({ length: 10000 }, _ => Math.floor(Math.random() * 300)));
Tests:
Set.union
const union = setA.union(setB);
Set.add
const union = new Set(setA); setB.forEach(v => union.add(v));
Set.union in the other order
const union = setB.union(setA);
Set.add in the other order
const union = new Set(setB); setA.forEach(v => union.add(v));