You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read somewhere that in order for the function to be eligible for inlining, the function body character limit (including white space) needs to be less than 600 characters and 196 AST nodes.
I see two ways to aid the user there: suggesting whitespace reduction if that is enough and suggesting minification if whitespace removal isn't enough.
The text was updated successfully, but these errors were encountered:
I searched for this a bit, a possible source for that info is here. The idea seems interesting. Some practical problems:
Mozilla AST (which acorn/esprima use internally) != V8 AST. The count will probably be off, although they seem reasonably similar on first look so counting mozilla ast nodes is probably a good enough heuristic.
when to activate this. Not every function will be inlined at runtime, and not every function needs to. There are multiple ways around this. A CLI flag, opt-in using a comment, opt-out using a comment.
Here's a man page I found for 10.25 exposing the option and its default, so it's definitely real. Someone I asked in IRC commented that it's an awful metric, but that's the way it is. I agree that not every function is going to be inlined, but to even be considered, it has to meet the source limit: 600 characters, so warnings / suggestions when it's close to the number and a bit of work could bring it under the limit would work. I dislike noisy lints myself.
I read somewhere that in order for the function to be eligible for inlining, the function body character limit (including white space) needs to be less than 600 characters and 196 AST nodes.
I see two ways to aid the user there: suggesting whitespace reduction if that is enough and suggesting minification if whitespace removal isn't enough.
The text was updated successfully, but these errors were encountered: