Comparison of YUI Compressor for .Net to Microsoft Ajax Minifier
updated 8 years ago
To get a reasonable sample of the performance I minified 3 different files with each method 1000 times. I attempted to configure both algorithms to produce the smallest output possible.
From these results you can see that Microsoft AJAX Minifier creates smaller files in about the same amount of time. Note, both algorithms have been set in aggressive, or hypercrush, mode to rename variables and perform other tweaks for reducing file size. The Microsoft AJAX Minifier seemed to have more granular options for tweaking output. However, the YUI Compressor is open source so you could add additional options if you need them.
|Scorecard||Speed||Size Reduction||Options||Build Task||Open Source|
|Microsoft AJAX Minifier|
And the Winner is..
It depends. I suggest using the Microsoft AJAX Minifier as it produces smaller files. However, the YUI Compressor.Net better satisfies my needs as it can minify both JS and CSS files. So, when I need to minify dynamic combinations of both types of files, I'll use Yahoo! UI Library: Compressor for .Net. When I need to do one-time minification during a build or prior to deployment, I'll use the Microsoft AJAX Minifier.
I've uploaded the test solution and console app so you can run the tests yourself.
JsMinTest.zip (291KB) fixed
- Ajaxian reviews output differences: Microsoft Ajax Minifier VS YUI Compressor
- YUI Compressor home page
- Scott Gu's Announcement: Announcing Microsoft Ajax Library (Preview 6) and the Microsoft Ajax Minifier
- Stephen Walther: Using the New Microsoft Ajax Minifier
Check out how I am using minification and combination in AtomSite to speed up page load time.