docs: update ivy perf notes (#24035)

PR Close #24035
This commit is contained in:
Olivier Combe 2018-05-21 20:50:29 +02:00 committed by Victor Berchet
parent 90bf5d8961
commit f6f44edcc0
1 changed files with 7 additions and 0 deletions

View File

@ -64,3 +64,10 @@ for (var i = 0, keys = Object.keys(obj); i < keys.length; i++) {
const key = keys[i];
}
```
## Recursive functions
Avoid recursive functions when possible because they cannot be inlined.
## Loops
Don't use foreach, it can cause megamorphic function calls (depending on the browser) and function allocations.
It is [a lot slower than regular `for` loops](https://jsperf.com/for-vs-foreach-misko)