object inject

Benchmark created on


Setup

const a = {};

for (let i = 0; i < 100; i++) {
	a[i] = i;
}

Test runner

Ready to run.

Testing in
TestOps/sec
plain assign
for (let i = 200; i < 210; i++) {
	a[i] = i;
}
ready
object.assign
const b = {};
for (let i = 200; i < 210; i++) {
	b[i] = i;
}
Object.assign(a, b);
ready
__proto__
const b = {};
for (let i = 200; i < 210; i++) {
	b[i] = i;
}
a.__proto__ = b;
ready

Revisions

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