aaa

Benchmark created on


Setup

const data = Array(9e6).fill(1).map((_, idx) => idx);

Test runner

Ready to run.

Testing in
TestOps/sec
a
const entry = {};
for(const item of data) {
	entry[item] = {
		...(entry[item] || {}),
		[item]: item
	}
}
ready
b
const entry = {};
for(const item of data) {
	if(!entry[item]) {
		entry[item] = {};
	}
	
	entry[item] = item;
}
ready

Revisions

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