Thread:Requests for comment/Minifier/Output comparison

Out of curiosity and to see how much more unreadable the resulting code becomes, I took the jquery.spinner module (it's tiny) and minified it using both methods.

JavaScriptMinifier (657 bytes): (function($){var defaults={id:undefined,size:'small',type:'inline'};$.extend({createSpinner:function(opts){if(opts!==undefined&&$.type(opts)!=='object'){opts={id:opts};}opts=$.extend({},defaults,opts);var $spinner=$(' ',{'class':'mw-spinner','title':'...'});if(opts.id!==undefined){$spinner.attr('id','mw-spinner-'+opts.id);}$spinner.addClass(opts.size==='large'?'mw-spinner-large':'mw-spinner-small');$spinner.addClass(opts.type==='block'?'mw-spinner-block':'mw-spinner-inline');return $spinner;},removeSpinner:function(id){return $('#mw-spinner-'+id).remove;}});$.fn.injectSpinner=function(opts){return this.after($.createSpinner(opts));};}(jQuery))

UglifyJS (545 bytes): !function(n){var e={id:void 0,size:"small",type:"inline"} n.extend({createSpinner:function(i){void 0!==i&&"object"!==n.type(i)&&(i={id:i}),i=n.extend({},e,i) var r=n(" ",{"class":"mw-spinner",title:"..."}) return void 0!==i.id&&r.attr("id","mw-spinner-"+i.id),r.addClass("large"===i.size?"mw-spinner-large":"mw-spinner-small"),r.addClass("block"===i.type?"mw-spinner-block":"mw-spinner-inline"),r},removeSpinner:function(e){return n("#mw-spinner-"+e).remove}}),n.fn.injectSpinner=function(e){return this.after(n.createSpinner(e))}}(jQuery)

(I did not try gzipping, someone probably should.)

I prettified these a bit (s/[{}]/\n$&\n/g, s/[,;]/$&\n/g, reindented) and compared visually. :) The (meaningful) differences are, at a glance:
 * Unnecessary semicolons removed (good)
 * Variables renamed (meh, we can live with this)
 * Comparisons reordered to Yoda-style (not sure why…)
 * 'undefined' replaced with 'void 0' (meh)
 * 'if(a){b}' replaced with 'a&&b' (pretty nasty)
 * In what-used-to-be-braces, semicolons replaced with commas (meh)
 * A reordered 'return' at the end (pretty nasty too)

It might make life a bit more difficult if one ever needs to debug the minified code. But, tempting…