Fun with JavaScript Profiling, Minification, and JSLint

I’ve been working with JSLint profiling and what they say is true: minification is more efficient if you write your JavaScript following certain JavaScript sub-standards (I know there’s a better way to phrase that).

File Sizes

Original: 27,542 bytes
Original (minified): 21,179
Linted: 30,714
Linted (minified): 20,899

Here’s the scoop. The original file size was 27,542 bytes. When rewritten using Crockford’s “Good Parts” settings in JSLint the file size grew to 30,714 bytes (by ~12%). The original file size minified to 21,179, a savings of 6,363 bytes (~23%).

Here’s where it gets cool.

Linting the file added 3,172. But doing so allowed the compression to reduce the file size to 20,899 bytes, shrinking it by 31% and making it even smaller than the original file was when it was minified!

Awesome and weird, right?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.