Bug report or feature request?
Hello, how are you? This is weird, but uglify-js v2 is 22.2 seconds and with v3 is 4 minutes.
How come?
ES5 or ES6+ input?
ES5 (from babel)
Uglify version (uglifyjs -V)
uglify-js 3.3.16
JavaScript input
UglifyJs2 size: 4.9 MB js, 4.7MB map, time: 22.2 seconds
./node_modules/.bin/uglifyjs ./.tmp/all.js --output ./dist/client/all.js --compress --mangle --source-map "./dist/client/all.js.map"

UglifyJs3 size: 4.9 MB js, 4.7MB map, time: 4m 19.7s
./node_modules/.bin/uglifyjs ./.tmp/all.js --output ./dist/client/all.js --compress --mangle --source-map

Of course I tried from command line as well, but same result. So it looks like it is not, because of grunt.



The uglifyjs CLI command executed or minify() options used.
I am using the CLI from a grunt via child process exec.
JavaScript output or error produced.
No error, just slow.
Comment:
UglifyJs 3 uses like 1 gigabyte (excluding sourcemap):

UglifyJs 2 uses (including sourcemap):

**JavaScript input**
A complete parsable JS program exhibiting the issue with
UglifyJS alone - without third party tools or libraries.
Ideally the input should be as small as possible.
Post a link to a gist if necessary.
Issues without a reproducible test case will be closed.
What do you mean small? This is 10 Megabytes. V2 is 22 seconds, V3 is 4 minutes, in building docker it is 48 minutes, while with v2 it is 1 minute.
This is from work, I can cannot provide the source, it is closed source.
So just use v2, given v3 is just unusable for an enterprise system?
Few seconds is ok, but for 10 MBytes form 22 seconds to 4 minutes, it is a problem.
Close it if you think v3 is good. :1st_place_medal:
What do you mean small? This is 10 Megabytes.
The operative word was "ideally", but ultimately the size of the JS input does not matter. Post a link to a gist.
This is from work, I can cannot provide the source, it is closed source.
So just use v2, given v3 is just unusable for an enterprise system?
This is an open source project made by unpaid volunteers in their own time which you're using for free. No sympathy here for a closed source test case.
You can create an example that is open source using a bunch a dummy functions with the same structure as your input.
Beyond that all I can suggest is to selectively disable each compress option one at a time or disable compress altogether and report your findings.
Few seconds is ok, but for 10 MBytes form 22 seconds to 4 minutes, it is a problem.
Close it if you think v3 is good. ๐ฅ
This ticket provides no actionable information. As a programmer you should know that. If you want to see a speed improvement then provide a JS input to reproduce the issue.
@kzc how are you? never mind, doesn't matter, v2 is fast and same size exactly and works, v3 is just some 10x slower, that's all, i just use v2. thanks so much! sincerely, patrikx3
ps: i guess it is just overrefactored and not faster , but slower, and even the size is exact...
@p3x-robot please show some respect to others who work hard to make this software available to everyone for free.
Given that you cannot give us a test case, your best bet is to try #3014 report back - there is another similar report but the person has yet to confirm whether the patch works so it has not been incorporated.
@alexlamsl you are right, respect, 100%
it is just a discussion, and the first problem i had one at work i used grunt-contrib-uglifyjs and the jenkins build became 48 minutes after an update.
i removed the grunt-contrib-uglifyjs i installed my own, it was fast, 22 seconds (which was in the jenkin build was like 1 minute), but then i saw that i installed uglifyjs2 and that's why it was faster.
i tried my own grunt task with v3, but the same exact 10x slower.
that's all, this is just a fact. not bullshit. given i wrote enough open source code and work, i have no idea why it is so slow, but i saw even with small js it was much slower.
so my opinion is that (given the size is exact like v2 vs v3) there is just something overrefactoring and given i have no right to give you a 10mb file (bower, angular templates , ngjs annotate and ngivr our system), i have no idea what to do, but given it is the exact size for me v2 is much better then v3 and i am just using it. that's all.
no harm.
i gave you some output i could, you can see i closed it, given i have no time to generate a 10mb bullshit that will not be real world code, just some blanks and emptiness.
given uglifyv3 is in fact slower than v2 and the reason behins is uglifyjs speed, in my opinion, so that's it, closed.
@p3x-robot in which case, can you install uglify-js version 3, apply that one line patch from #3014:
- has_parens : function() { return OUTPUT.slice(-1) == "(" },
+ has_parens : function() { return OUTPUT[OUTPUT.length - 1] == "(" },
(the file in question should be located under node_modules/uglify-js/lib/output.js in your case)
Then report back if the slow down is still there or not?
hold on, i check it out. thanks

Running "ngivr-uglifyjs" task
Executing UglifyJs command: node_modules/.bin/uglifyjs .tmp/all.js --output dist/client/all.js --compress --mangle --source-map "filename=dist/client/all.js.map"
Running "ngivr-build" task
Running "clean:tmp" (clean) task
>> 1 path cleaned.
Done.
Execution Time (2018-03-23 20:33:28 UTC+1)
babel:dist 18.8s โโโโโโโ 7%
ngivr-uglifyjs 4m 17.2s โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 90%
Total 4m 45.5s
ciao!
how are you?
Looks like it is a bit bloated now and for a big system use case is not usable, v2 is awesome!!!! thanks anyways i doubt v2 es5 will change ever. so i am happy. thanks again! sincerely,
p3x
Look:
So happy :)
Running "ngivr-uglifyjs" task
Executing UglifyJs command: node_modules/.bin/uglifyjs dist/client/all.js --output dist/client/all.js --compress --mangle --source-map "dist/client/all.js.map"
Running "ngivr-build" task
Running "clean:tmp" (clean) task
>> 1 path cleaned.
Done.
Execution Time (2018-03-23 20:45:58 UTC+1)
ngivr-settings 529ms โ 1%
cssmin:bower 785ms โโ 2%
cssmin:ngivr 996ms โโ 2%
ngivr-ngtemplates-override 1.1s โโ 2%
babel:dist 17.9s โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 36%
copy:dist 2.2s โโโโ 4%
copy:fonts 1.7s โโโ 3%
ngAnnotate:dist 1.1s โโ 2%
ngivr-uglifyjs 22.3s โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 45%
Total 49.9s
@p3x-robot thanks for the testing.
Most helpful comment
@p3x-robot please show some respect to others who work hard to make this software available to everyone for free.
Given that you cannot give us a test case, your best bet is to try #3014 report back - there is another similar report but the person has yet to confirm whether the patch works so it has not been incorporated.