Javascript Optimizations

I was looking at kangax‘s suggestions for Google Closure compression techniques and I wanted to know how UglifyJS handled it.

var i = 10000,
j = 0.1,
k = /[\w]/,
m = new Array(1, 2, 3);
throw 0.1;

var i=1E4,j=0.1,k=/[\w]/,m=[1,2,3];throw 0.1;

var i=1e4,j=.1,k=/[\w]/,m=new Array(1,2,3);throw.1

Interesting that UglifyJS doesn’t compress the Array declaration, but does compress 2 other statements that Google Closure doesn’t/won’t.

In UglifyJS’s README it states that Google Closure “runs terribly slow”. Why is this an issue? Won’t you only compress when pushing to prod?