docs: add a link to "Impact of polymorphism [...]" to the perf notes (#23151)
PR Close #23151
This commit is contained in:
parent
d37064ce28
commit
412b85ba89
@ -13,20 +13,22 @@ shown here: https://jsperf.com/small-arrays-vs-linked-objects
|
|||||||
|
|
||||||
## Monomorphic vs Megamorphic code
|
## 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.
|
1) Monomorphic prop access is 100 times faster than megamorphic.
|
||||||
2) Monomorphic call is 4 times faster the megamorphic call.
|
2) Monomorphic call is 4 times faster the megamorphic call.
|
||||||
|
|
||||||
See benchmark [here](https://jsperf.com/mono-vs-megamorphic-property-access).
|
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
|
Exporting top level variables should be avoided where possible where performance
|
||||||
and code size matters:
|
and code size matters:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Typescript
|
// Typescript
|
||||||
export let exported = 0;
|
export let exported = 0;
|
||||||
let notExported = 0;
|
let notExported = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user