[1] https://top.fse.guru/nodejs-a-quick-optimization-advice-7353...
[1] https://top.fse.guru/nodejs-a-quick-optimization-advice-7353...
In what kind of world is that a sensible metric to decide if a function can be inlined?
> Graph generation: Crankshaft builds the Hydrogen control flow graph using the AST, scope info, and type feedback data extracted from the full-compiled code. Inlining also happens at this stage. Hydrogen is Crankshaft's high-level architecture-independent intermediate representation.
> Inlining: Performed during the graph generation phase. The inlining heuristic is very simple: basically, if the function being called is known, and it is safe to inline, the function will be inlined. Large functions (>600 source characters including whitespace or 196 AST nodes) will not be inlined. Cumulatively, a total of 196 AST nodes can be inlined in a single function.
So they do use AST nodes as a heuristic; I don't really understand why they would also use "source characters including whitespace" though.
Guess I better keep my comments outside the function body from now on when possible.
I mean, why would they fix it with high priority if the engine already has reasonable performance and the benchmarks are happy as well?