TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Compare different JS minifiers’ output online

26 pointsby gillybover 10 years ago

8 comments

worikover 10 years ago
&quot;An error occurred while trying to compress javascript text.&quot;<p>Hmmm....<p>Firstly I think I gave it too much JS code to deal with and it choked (about 3,000 lines).<p>Running it twice in a row always causes it to fail in my experience so far.<p>I am not quite sure what it is trying to do. I get a little report like:<p>Original file size : 1,009bytes JSMin : 706bytes (30%) UglifyJS : 644bytes (36%) YUI Compressor : 647bytes (35%) Closure Compiler : 638bytes (36%)<p>but no sign of the compressed code except the code I enter has most new lines removed. The newlines between function declarations are maintained.<p>The above report I pasted inline is after I asked for one algorithm to be tested (Closure Compiler) but it reported on all of them.<p>This is a good idea, and it would be useful if:<p>(a) it could cope with 3,000 lines about 120K. That is not much<p>(b) Gave me a bit more information about what the compression is doing. I care about more than the sizw. At the very least show me the compressed code.<p>(c) Let me test one algorithm at a time<p>peace W
评论 #8580897 未加载
Theyeardover 10 years ago
Wow, great idea. I wish this was available as a npm package.<p>A couple of things, sometimes the service doesn&#x27;t work and returns &quot;YUI Compressor : 0bytes (100%)&quot; or &quot;JSMin : 886bytes (0%)&quot;. A typo: succees.<p>The references section could be expanded with resources about writing JS code in a way that enables optimizations:<p><a href="http://toddmotto.com/what-function-window-document-undefined-iife-really-means/" rel="nofollow">http:&#x2F;&#x2F;toddmotto.com&#x2F;what-function-window-document-undefined...</a><p><a href="https://curiosity-driven.org/minimal-loader" rel="nofollow">https:&#x2F;&#x2F;curiosity-driven.org&#x2F;minimal-loader</a>
评论 #8580846 未加载
dkopiover 10 years ago
Pretty cool, but comparing file sizes probably isn&#x27;t enough. We should also compare the file sizes after gzipping. smaller js files doesn&#x27;t necessarily mean smaller zipped files.<p>Also, size comparison ignores speed improvements due to load time and runtime optimizations that closure compiler does and uglify doesn&#x27;t. (Although you&#x27;ll have to use ugly code annotations to get closure compiler to do its magic).
评论 #8580975 未加载
评论 #8580865 未加载
sligover 10 years ago
Nice one, thanks for sharing!<p>I&#x27;ve been researching for a minifier recently and on my tests Closure Compiler always win on the file size metric. However, due to the Closure Compiler Java dependency, I&#x27;ll likely choose UglifyJS (which is always the second best on my tests).<p>Have you noticed cases where Closure Compiler or UglifyJS aren&#x27;t the best?
评论 #8580851 未加载
gillybover 10 years ago
I fixed many of the bugs happening on the site, and there&#x27;s much less traffic now, so if someone didn&#x27;t get a chance to see it, you can come back now :)
JayXonover 10 years ago
Very nice, could you display the best output result? So that we don&#x27;t need to compress again ourselves.
评论 #8581135 未加载
ilancoover 10 years ago
502 bad gateway
评论 #8580831 未加载
mmastracover 10 years ago
This looks like it might have been an interesting submission, but I&#x27;m getting a bad gateway error when clicking through.<p>Also, you should re-title it as Show HN to get better visibility!<p>EDIT: author has fixed it.
评论 #8580764 未加载