Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Mono- vs Poly- vs Megamorphic v1
(version: 1)
Comparing performance of:
Monomorphic vs Polymorphic vs Megamorphic
Created:
3 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
function getProp1() { this.a; } function getMonoData(){ return [{ getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp1, b: "", c: "", d: "", e: "", f: "", a: "" }, ]; } function getProp2() { this.a; } function getPolyData(){ return [{ getProp: getProp2, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp2, g: "", h: "", i: "", j: "", k: "", a: "" }, { getProp: getProp2, l: "", m: "", n: "", o: "", p: "", a: "" }, { getProp: getProp2, q: "", r: "", s: "", t: "", u: "", a: "" }, { getProp: getProp2, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp2, g: "", h: "", i: "", j: "", k: "", a: "" }, { getProp: getProp2, l: "", m: "", n: "", o: "", p: "", a: "" }, { getProp: getProp2, q: "", r: "", s: "", t: "", u: "", a: "" }, { getProp: getProp2, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp2, g: "", h: "", i: "", j: "", k: "", a: "" }, ]; } function getProp3() { this.a; } function getMegaData(){ return [{ getProp: getProp3, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp3, g: "", h: "", i: "", j: "", k: "", a: "" }, { getProp: getProp3, l: "", m: "", n: "", o: "", p: "", a: "" }, { getProp: getProp3, q: "", r: "", s: "", t: "", u: "", a: "" }, { getProp: getProp3, v: "", w: "", x: "", y: "", z: "", a: "" }, { getProp: getProp3, b: "", c: "", d: "", e: "", f: "", a: "" }, { getProp: getProp3, g: "", h: "", i: "", j: "", k: "", a: "" }, { getProp: getProp3, l: "", m: "", n: "", o: "", p: "", a: "" }, { getProp: getProp3, q: "", r: "", s: "", t: "", u: "", a: "" }, { getProp: getProp3, v: "", w: "", x: "", y: "", z: "", a: "" }, ]; } function test(data) { for (const obj of data) { obj.getProp(); } }
Tests:
Monomorphic
test(getMonoData());
Polymorphic
test(getPolyData());
Megamorphic
test(getMegaData());
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Monomorphic
Polymorphic
Megamorphic
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'll do my best to provide an answer. Based on the provided code snippets, I notice that all of them are test cases for benchmarking purposes, likely evaluating the performance of the `getMonoData()`, `getPolyData()`, and `getMegaData()` functions. The code snippets appear to be arrays of objects, where each object contains a function call (`getProp`) as a property. The values associated with these properties are either empty strings or identical to the values in an array defined elsewhere. To provide an answer, I'll need to know what specific question is being asked. Is it related to: 1. Identifying the differences between the three benchmarking tests? 2. Understanding how the `getProp` functions interact with the objects in the arrays? 3. Something else? If you could provide more context or clarify your question, I'd be happy to try and assist further.
Related benchmarks:
map - named function vs anonymous function
isArray vs instanceof vs Symbol.iterator vs Object.prototype.toString.call
Map vs switch soh
isArray vs instanceOf vs Symbol.iterator vs Object.prototype.toString.call.slice
instanceof vs .prototype.isPrototypeOf vs Object.prototype.toString.call vs typeof vs isArray vs Symbol.iterator
Comments
Confirm delete:
Do you really want to delete benchmark?