-
Notifications
You must be signed in to change notification settings - Fork 4
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
Can we minimize more? #6
Comments
Upon closer examination, we could definitely minimize more - some statements that are deliberately broken up (for instance, on a second line) for style remain on a different line in the minimized output. This could be fixed by keeping track of brackets and parenthesis during the initial grouping of tokens. |
minimizer.py is now keeping track of brackets and closures and will not create a new token group unless the brackets have been balanced out. This will ensure that lines that have been split up for style will be reassembled on the same line. |
Can we tree shake then minimize? |
Interesting suggestion - tree shaking is difficult for dynamic languages, even JavaScript relies on the import and export syntax to maintain a semblance of static structure in order to conservatively remove outgoing code. I would prefer to stick to static analysis methods like vulture or pyan as the alternative (something like pycallgraph, maybe?) seems like it would require more knowledge about how the program is executed than I would like the minimizer to care about. Vulture seems like a plausible path forward on this, such that a user could specify an option to search for and remove dead code and provide the minimizer with a confidence threshold. I will look into it. |
Is the output of the minimizer truly the most minimized it could be?
The text was updated successfully, but these errors were encountered: