YUI Compressor Online is a site to compress Javascript files fluently used to manage dynamic data (AJAX) or display effects (in the photo galleries for example). These scripts can sometimes exceed 100 kb and their total size is increasing rapidly, generating load time of pages sometimes very long.
WordPress support such scripts prototype.js (121.2 kb) effects.js (38 kb) jquery.js (30.3 kb) and lightbox.js (20.8 kb) when using the Lightbox 2 plugin. All this is already 210.3 kb scripts to load to display the home page. Once compressed with YUI Compressor, file sizes go to 70.9, 24.3, 30.1 and 11 kb or 136.3 kb and a reduction of 35.2%. Note that is smaller than jquery and prototype is already properly optimized, which explains the very small gain in size after compression. Regardless of this script is the gain of 41%. This results in a shorter loading time of about 2s on my homepage, which is far from negligible, not to mention the bandwidth savings.
This compression method removes spaces and other uses various tricks to reduce the size of a JavaScript file, it is not truly a compression as if we used eg gzip. The advantage of this method is that no code changes to calling JavaScripts PHP files is required, its disadvantage is that files are still relatively large (prototype.js can be compressed into 15 kb with eg gzip).
Tags: Javascript , Optimization , Wordpress









