fixup! docs: add Function Inlining
rules to PERF_NOTES.md
Co-Authored-By: mhevery <misko@hevery.com>
This commit is contained in:
@ -73,7 +73,7 @@ Avoid recursive functions when possible because they cannot be inlined.
|
|||||||
VMs gain a lot of speed by inlining functions which are small (such as getters).
|
VMs gain a lot of speed by inlining functions which are small (such as getters).
|
||||||
This is because the cost of the value retrieval (getter) is often way less than the cost of making a function call.
|
This is because the cost of the value retrieval (getter) is often way less than the cost of making a function call.
|
||||||
VMs use the heuristic of size to determine whether a function should be inline.
|
VMs use the heuristic of size to determine whether a function should be inline.
|
||||||
Thinking is that large function probably will not benefit inlining because the overhead of function call is not significant to the overall function execution.
|
Thinking is that large functions probably will not benefit inlining because the overhead of function call is not significant to the overall function execution.
|
||||||
|
|
||||||
Our goal should be that all of the instructions which are in template function should be inlinable.
|
Our goal should be that all of the instructions which are in template function should be inlinable.
|
||||||
Here is an example of code which breaks the inlining and a way to fix it.
|
Here is an example of code which breaks the inlining and a way to fix it.
|
||||||
|
Reference in New Issue
Block a user