Examples
To demonstrate the benefits of minification and obfuscation, I have generated two scripts of different sizes: a small script (50K) and a large script (377K). The small script drops to 13K after minification and 12K after obfuscation. The large script is reduced to 129K after minification and 123K after obfuscation. Testing both files under these three states results in the following six examples.
- Small Script Normal
- Small Script Minified
- Small Script Obfuscated
- Large Script Normal
- Large Script Minified
- Large Script Obfuscated
As shown in Table 12-3, minification and obfuscation perform about the same, but are significantly faster than the normal case. For the small script, minification and obfuscation are 100â110ms (17â19%) faster than the normal case. For the large script, minification and obfuscation are 331â341ms (30â31%) faster than the normal case.
Table 12-3. Response times for minified and obfuscated scripts
Script size | Normal | Minified | Obfuscated |
---|---|---|---|
Small (50K) | 581 ms | 481 ms | 471 ms |
Large (377K) | 1092 ms | 761 ms | 751 ms |
As mentioned in the previous section, the difference between minification and obfuscation decreases when combined with gzip compression; this is demonstrated by these examples. ...
Get High Performance Web Sites now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.