Issue link: https://read.uberflip.com/i/1146286
Icing on the Cake | 73 As shown in Table 10-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. As mentioned in the previous section, the difference between minification and obfus- cation decreases when combined with gzip compression; this is demonstrated by these examples. Minifying scripts reduces response times without carrying the risks that come with obfuscation. Icing on the Cake There are a couple other ways to squeeze waste out of your JavaScript. Inline Scripts The discussion thus far has focused on external JavaScript files. Inline JavaScript blocks should also be minified, though this practice is less evident on today's web sites. Table 10-4 shows that although 4 of the 10 top web sites minify their external scripts, only 3 minify their inline scripts. Table 10-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 Table 10-4. Inline minification practices across 10 top web sites Web site External scripts minified? Inline scripts minified? http://www.amazon.com no no http://www.aol.com no no http://www.cnn.com no no http://www.ebay.com yes no http://froogle.google.com yes yes http://www.msn.com yes yes http://www.myspace.com no no http://www.wikipedia.org no no http://www.yahoo.com yes yes http://www.youtube.com no no

