Object construction

Benchmark created on


Setup

const miniObjects = Array.from({ length: 1000 }).map((_, idx) => ({ [`item${idx}`]: idx }));
const entries =  Array.from({ length: 1000 }).map((_, idx) => ([`item${idx}`, idx ]));

Test runner

Ready to run.

Testing in
TestOps/sec
reduce
const result = miniObjects.reduce((acc, cur) => ({ ...acc, ...cur }), {});
ready
fromEntries
const result = Object.fromEntries(entries);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.