Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Merge+object.keys vs set vs for
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/130.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 130
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Set
790286.6 Ops/sec
Merge
1759033.6 Ops/sec
Script Preparation code:
const a = { a: 1, b: 2 }; const b = { b: 3, c: 4 };
Tests:
Set
const s = new Set([ ...Object.keys(a), ...Object.keys(b), ]); const res = Array.from(s);
Merge
const c = { ...a, ...b }; const res = Object.keys(c);
For
const s = new Set(); for(const x in a) s.add(x); for(const x in b) s.add(x); const res = Array.from(s);