diff --git a/packages/core/src/render3/PERF_NOTES.md b/packages/core/src/render3/PERF_NOTES.md index 39fd208887..d031899025 100644 --- a/packages/core/src/render3/PERF_NOTES.md +++ b/packages/core/src/render3/PERF_NOTES.md @@ -13,20 +13,22 @@ shown here: https://jsperf.com/small-arrays-vs-linked-objects ## Monomorphic vs Megamorphic code -Great read: [What's up with monomorphism?](http://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html) +Great reads: +- [What's up with monomorphism?](http://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html) +- [Impact of polymorphism on component-based frameworks like React](http://benediktmeurer.de/2018/03/23/impact-of-polymorphism-on-component-based-frameworks-like-react/) 1) Monomorphic prop access is 100 times faster than megamorphic. 2) Monomorphic call is 4 times faster the megamorphic call. See benchmark [here](https://jsperf.com/mono-vs-megamorphic-property-access). - ## Exporting top level variables +## Exporting top level variables - Exporting top level variables should be avoided where possible where performance - and code size matters: +Exporting top level variables should be avoided where possible where performance +and code size matters: - ``` - // Typescript +``` +// Typescript export let exported = 0; let notExported = 0; @@ -54,7 +56,7 @@ Also writing to a property of `exports` might change its hidden class resulting ## Iterating over Keys of an Object. -https://jsperf.com/object-keys-vs-for-in-with-closure/3 implies that `Object.keys` is the fastest way of iterating +https://jsperf.com/object-keys-vs-for-in-with-closure/3 implies that `Object.keys` is the fastest way of iterating over properties of an object. ```