A dictionary of the content transforms used in the Jitify software:
To minify content is to make it smaller by removing inessential elements. For textual web content such as CSS, minification usually means removing comments and any whitespace that is not syntactically necessary.
As of release 0.9.1, Jitify can minify of the following content types:
- CSS - relatively thorough removal of inessential elements
- JavaScript - moderate minification, roughly equivalent to jsmin
- HTML - light minification (Linefeeds are left in place, for example. This may change in later releases.)
The Jitify content processing core--the part of the Jitify code that handles minification and other content-rewriting functions--was designed around two goals:
- Streaming
For dynamic content minification inside a web server or proxy, it is useful to be able to process content in small blocks. Compared to the alternative of needing the entire document in memory at once, streaming content processing lowers the server's memory footprint and allows the server to start sending the optimized response to the browser sooner.
- Speed
When operating on blocks of 4-8KB in size (typical of the block sizes used by many web servers when proxying content), the current Jitify code can minify HTML at a speed of 5-15 nanoseconds per byte on a single core of a 2.8 GHz x64 processor. That's fast enough to do real-time minify on websites with a few hundred Mb/s of outbound traffic per server. (In comparison, dynamic gzip compression of HTML on the same test platform takes 30-60 nanoseconds per byte.)
How much does minification help? The answer varies widely based on the input content. Here are examples obtained by testing the home pages of a few popular websites in Q2 2010. All numbers indicate sizes in bytes.
| Website | Original Page | Compressed | Minified | Minified & Compressed |
|---|---|---|---|---|
| CNET | 70355 | 15634 | 65961 | 14716 |
| Yahoo! Finance | 83227 | 18203 | 76870 | 17458 |
| 13020 | 5112 | 13020 | 5112 |
These examples illustrate some important points:
- Minification can be a win even for sites that already are doing dynamic gzip compression of their textual content.
- Sites that aren't already doing dynamic gzip compression of their textual content should strongly consider it. (Nearly every major web server and load balancer supports this feature.)
- The effectiveness of any optimization depends on the input content. The Google home page is already minified, so additional minification yields no benefit.