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 (iPad; CPU OS 18_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/132.0.6834.100 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 132
Operating system:
iOS 18.1.1
Device Platform:
Tablet
Date tested:
one year ago
Test name
Executions per second
Monomorphic
35398024.0 Ops/sec
Monomorphic Typed
34668316.0 Ops/sec
Empty Object
19402314.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());