-
Notifications
You must be signed in to change notification settings - Fork 64
Bad compile time performance #24
Comments
What options are you using? Closure is a lot more than just a transpiler so if you only want to use it for transpilation then you can turn off lots of other things (like typechecking). That said, we are looking at ways to improve performance, and we are aware that the JS version is likely to be slower right now for some use cases. |
My main use case is minifying a 2.5 MB ES5 project, which with uglifyjs takes ~6 seconds to minify and ~150 seconds with CC. What options would you recommend I disable (or enable) for best results for this use case? |
Try both simple mode and advanced mode, and measure the runtime, total code size, and total codesize after gzipping (assuming that you can serve your code gzipped). It may be that the gzipped results are almost the same for simple mode and advanced mode, in which case you probably want to stick to simple mode, which will hopefully be quite a bit faster. Another thing you can try is |
@qyoz Assuming you are using |
@Dominator008 The project I'm working on is private, that's why I used jQuery as a test case for this benchmark. The difference in compile-time ratio is easily reproduced. I can tell you that using CC to compile jQuery with the default options ( @MatrixFrog I've tried both |
I'm seeing the same problem. GCC is literally unusable and I can't even see what the output is since I am not willing to wait. I have some very large files due to a lot of dependencies with large sizes and uglifyjs can handle this in roughly 30s-60s. GCC 17 minutes later has yet to even complete.
Edit: It took a total of 1370.3 s to complete, including general webpack overhead so shave about 20-30s off |
Here is reproducible example I'm having troubles with: https://github.com/nazar-pc/closure-compiler-bug-24 |
I can confirm the bad performance even with |
I'm closing this issue. The compile time performance isn't directly related to the JS publication to NPM. Any compilation time issues need reported to the main repository: https://github.com/google/closure-compiler |
@ChadKillingsworth, Java version doesn't have this issue |
This repo doesn't house the source code for the compiler - just the npm distribution and publication. Even the JS version compilation time would need to be addressed in the other repo. |
I benchmarked this port against other transpilers using jQuery and found that it takes an extraordinary ~13 seconds to transpile using closure-compiler-js as opposed to a little over ~1 second with uglifyjs or esprima.
I understand that this port was generated using a Java to JS compiler and looking at jscomp.js it is really not a big surprise as to why this takes so long, there is a lot of redundancy behind the scenes.
However, it pretty much renders this port useless when tranpiling large projects or when using this module in the browser.
If it takes less time to spawn a child process and compile with the native Java compiler then what's the point?
It makes more sense to me to write this module properly from a technical spec than to have something generated and under perform.
The text was updated successfully, but these errors were encountered: