Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Immutable.Set Union vs Constructing a new plain JS Set
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/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Immutable.Set union
10514.1 Ops/sec
Convert JS Set to array, construct new Set
17134.7 Ops/sec
Array.from, construct new Set
17809.6 Ops/sec
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/immutability-helper@2.7.0/index.min.js"></script>
Tests:
Immutable.Set union
const set1_Immutable = new Immutable.Set(Array.from(Array(100).keys())); const set2_Immutable = new Immutable.Set(Array.from(Array(1000).keys())); const result = set1_Immutable.union(set2_Immutable)
Convert JS Set to array, construct new Set
const set1_JS = new Set(Array.from(Array(100).keys())); const set2_JS = new Set(Array.from(Array(1000).keys())); const result = new Set([...set1_JS, ...set2_JS])
Array.from, construct new Set
const set1_JS = new Set(Array.from(Array(100).keys())); const set2_JS = new Set(Array.from(Array(1000).keys())); const result = new Set(Array.from(set1_JS).concat(Array.from(set2_JS)))