Here are some of the recommendations we have come up based on perf-quest.
This document is a output of this issue
It is always interesting to read about what we should or should not do related to performance. Doing so based on test results is even better.
-
Give preference to the use of ES6 classes. We have 4 tests related with ES6 classes, and they win on the first three cases.
-
Avoid
forEach
-
Avoid the creation of extra hidden classes
-
Filter the array 'by hand' instead
array.filter
-
Map the array 'by hand' instead
array.map
-
Use
array.reduce
instead do it 'by hand' -
If you are using WeakMap for data hiding, then prefer Symbol
- Clone perf-quest
- Create a new issue
- Follow the readme
Our current plan on this issue is to write test cases to get results based on:
- Our doubts and project needs.
- Try to cover affirmations like 'Don't do X, don't do Y' found in videos and blogs.
example: "Don't use prototypes because this has a bad performance"
- http://debuggable.com/posts/understanding-hidden-classes-in-v8:4c7e81e4-1330-4398-8bd2-761bcbdd56cb
- https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/
- https://gist.github.com/twokul/9501770
- https://www.html5rocks.com/en/tutorials/speed/v8/
- https://coderwall.com/p/kvzbpa/don-t-use-array-foreach-use-for-instead
- https://www.youtube.com/watch?v=UJPdhx5zTaw
- http://lanceball.com/words/2016/10/14/data-hiding-in-es6/