Small Lessons Learned Prepping Entry for 10k Contest

Some things I’ve learned prepping my entry for the 10k.aneventapart contest.

I opted for dean edwards packer. It seems to give the best results. I don’t know that I would use it on a production site – I tend to lean more towards YUI Compressor or Closure Compiler these days – but for this contest, it was appropriate.

One thing I noticed is the following pattern doesn’t compress well: (when selecting Shrink variables option)

var foo = false,
    bar = 1,
    zee = 'jimminey',
    yalta = 1;

The var names besides the first won’t be shortened. If you are counting every byte, go for

var foo = false;
var bar = 1;
var zee = 'jimminey';
var yalta = 1;

If you are using the jQuery as your lib, if you make a call to $(‘foo’) more than once, then assign it to a variable – it will get shortened when packed.

In the end, I had some K to spare, so I didn’t go as far as I could have in compressing things – using single letter id’s for example.

When I began, I didn’t think I would have room to use YUI CSS reset. If I was doing it again, I would definitely include it.