New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix _guessExecutionStatusRelativeToDifferentFunctions
perf
#14617
Fix _guessExecutionStatusRelativeToDifferentFunctions
perf
#14617
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52074/ |
Is it possible to write an unit test for this fix? |
It's kind of hard, I've tried stripping down the reproducible code and it still ends up being over 2000 lines. Of course I can also add a test if you think it's needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. This PR improves the _guessExecutionStatusRelativeToDifferentFunctions
performance dramatically via dynamic programming. The execution status is cached so that when we don't have to descend into nodes when they are queried again by recursive calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that we have to manually maintain the executionStatusCache
status (undefined vs inited), because it could be easily managed just relying on the call stack and passing the map as a parameter.
However, I don't see an easy way to do so without modifying exposed functions. We should refactor this in the future, maybe Babel 8.
path._guessExecutionStatusRelativeToDifferentFunctions
Sometimes extremely slow_guessExecutionStatusRelativeToDifferentFunctions
perf
Accurately speaking, it will not hang infinitely, but it is extremely slow.
After applying this modification it will go from about 10 minutes to 100ms.