Gzip versus minify

Very simple to test. I took your js, put them in different files and ran gzip -9 on them. Here’s the result. This was done on a WinXP machine running Cygwin and gzip 1.3.12.

-rwx------  1 xxxxxxxx mkgroup-l-d     88 Apr 30 09:17 expanded.js.gz

-rwx------  1 xxxxxxxx mkgroup-l-d     81 Apr 30 09:18 minified.js.gz

Here’s a further test using a real-world JS example. The source file is “common.js” The original file size is 73134 bytes. Minified, it came to 26232 bytes.

Original file:

-rwxrwxrwx 1 xxxxxxxx mkgroup-l-d 73134 Apr 13 11:41 common.js

Minified file:

-rwxr-xr-x 1 xxxxxxxx mkgroup-l-d 26232 Apr 30 10:39 common-min.js

Original file gzipped with -9 option (same version as above):

-rwxrwxrwx 1 xxxxxxxx mkgroup-l-d 12402 Apr 13 11:41 common.js.gz

Minified file gzipped with -9 option (same version as above):

-rwxr-xr-x 1 xxxxxxxx mkgroup-l-d  5608 Apr 30 10:39 common-min.js.gz

As you can see, there is a definite difference between the various methods. The best bet is to both minify as well as gzip them.

Leave a Comment