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
max_line_len has very bad performance on big bundles #926
Comments
Out of curiosity, what is the reason for using this option? I've always considered it only a "formatting" option and I want to remove it with others like it. |
There are some tokens that don't accept newlines after them, such as |
The main reason is that both Chrome and Firefox devtools hang (and often even crash) when you try to debug such large bundles. Especially when investigating performance or bugs in production, we have to load the minified version first before even loading source maps or formatting them with the builtin tools. Just to give you an example, having a minified 5MB compressed file with Obviously, this is not necessarily a terser issue, as would be nicer if devtools would work regardless of line length, but it's the easiest option to solve a big dev pain. So we don't use it as "formatting" option (agree with you that terser should not care about that stuff) but to solve an actual browser limitation. |
Thanks for letting me know! That makes a lot of sense. Files with a very large first line are the only thing that lags vim for me. If there isn't a proper max_line_length that's fast and precise, at least there should be a faster option that does the same, with less precision. Some lines might be larger, or smaller, but it would use a more basic algorithm. However I don't think this has a high priority especially when compared with the obscene amount of RAM terser uses with large payloads. |
Hello, I also expect better max_line_len, and the below is my intent:
So I have a plan to use |
Fixed by #1109. |
@albertogasparin Thnx! Your comment helped me with resolving issue we had on lambda node 14.x. |
Bug report or Feature request? Feature request
(even if the performance regression is > 25% more time so quite big)
Version master
minify()
options usedmax_line_len: 120
terser
input Very large js files, for instance > 5MBterser
output or error Build time increase by 25% or more. On our CI webpack builds went from 20min to 25min by changingmax_line_len
from32000
to120
Expected result
Performance impact should be negligible.
Wonder if there is some optimisation we can add to https://github.com/terser/terser/blob/master/lib/output.js#L363
The text was updated successfully, but these errors were encountered: