-
Notifications
You must be signed in to change notification settings - Fork 419
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
In-place minification #638
Comments
I have a patch ready for this, but it's buggy. I went to contribute it, only to find out that the 0.11 I wrote it against is being thrown away, along with all of |
I tested a very simple thing: apply So you can try such a simple instruction on your grammar, but I’m afraid that removing spaces will not change significantly the minification time. Depending on your goals, you can almost instantly divide by 3 the size, simply by removing initial spaces. Else given your figure of 2 minutes for uglify for a grammar of size similar to mine, terser seems to do better, you should try on your grammar. (*) I remarked a few unused rules are completely dropped after minification, that’s fine :) |
the problem is that'll interfere with things that actually have multiple spaces in their rules my grammar is 34k and produces a 3.9 meg parser 🤣 |
Issue type
Prerequisites
Description
PEG parsers sometimes get really large because they're indented for human readability. I would like to add an option to change that.
My PEG grammar is about 34k. The parser it produces is about 1.7 meg. If you run that through Uglify3, it's about 101k, or a 94.2% reduction.
Thing is, I tried turning off symbol scrambling and relabelling, and it still dropped 93% in size. Almost all of that was just removing spaces
I can't find a minifier that can do this in under 2 minutes. Uglify takes about 2:40 on GH actions. My builds are [node 12,13][win,mac,linux][ff,ie,ch].
That means every time I commit, I spend about 45 minutes (spend because they cost money) on just minification.
I want to contribute a patch that fixes this. I don't know whether to work against 0.10 or 0.11
The preview pane from my editor is pretty amusing, as the code gets so deep (wasted spaces) that it entirely exits the preview panel for several hundred lines
The thing is, if you switch the thing from "for speed" to "for size," it stops wasting all that space, but then it also compiles a pretty slow parser
I'd like the fast parser's structure without the million wasted spaces (it's actually about 1.67 million wasted spaces in my current build)
Steps to Reproduce
Expected behavior:
The text was updated successfully, but these errors were encountered: