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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
Immutable.Set union
5329.5 Ops/sec
Convert JS Set to array, construct new Set
12857.4 Ops/sec
Array.from, construct new Set
13985.0 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)))