Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Monomorphic vs Typed Monomorphic vs Empty Object prop assignment
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/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Monomorphic
6825592.0 Ops/sec
Monomorphic Typed
6891671.0 Ops/sec
Empty Object
6057237.0 Ops/sec
Script Preparation code:
const source = { a: "", b: "", c: "", setA: function() { this.a = ""; }, setB: function() { this.b = ""; }, setC: function() { this.c = ""; }, }; function assignProps1(target) { for (const key in source) { target[key] = source[key]; } }; function assignProps2(target) { for (const key in source) { target[key] = source[key]; } }; function assignProps3(target) { for (const key in source) { target[key] = source[key]; } }; const noop = function() {}; function getMonoData() { return { a: null, b: null, c: null, setA: null, setB: null, setC: null }; } function getTypedData() { return { a: "", b: "", c: "", setA: noop, setB: noop, setC: noop }; } function getEmptyData() { return {}; }
Tests:
Monomorphic
assignProps1(getMonoData());
Monomorphic Typed
assignProps2(getTypedData());
Empty Object
assignProps3(getEmptyData());