The latest version of the Apache module further improves the optimizations

Dec 20, 2012 11:05 GMT  ·  By

Google's mod_pagespeed, as the name suggests, is an Apache module that aims to optimize performance, i.e. page speed. It does this in a variety of ways, minimizing resources, optimizing code, compressing files and so on.

The latest version, mod_pagespeed 1.2 comes with a couple of features that should improve performance even further.

The two big additions, and part of the default optimization set, are canonicalize_javascript_libraries and insert_dns_prefetch. Again, you can tell what they do from the name.

canonicalize_javascript_libraries

The vast majority of websites, certainly any website of even moderate complexity, uses some JavaScript libraries, usually more than one. jQuery and jQuery UI are common examples, but there are more.

In fact, it's very likely that several components on a page, including third-party code, relies on JavaScript libraries, many times the same ones.

But, while they may be using the same library, they may be fetching it from different places. What this means is that the same file, the same code, gets downloaded from several places on the web, several times for the same website. Obviously, that's a waste of resources.

With canonicalize_javascript_libraries, all the links to libraries are replaced with the versions hosted by Google itself over at ajax.googleapis.com.

Most websites rely on Google's version of jQuery, for example, so the browser may not even need to download the library if another website used it already and it's still cached.

insert_dns_prefetch

The second big new filter is insert_dns__prefetch, which adds a <link rel="dns-prefetch"> tag to your HTML files, appropriately instructing the browser to resolve the DNS for all the resources in the page before they're actually used. While the rest of the page loads, DNS data is pulled and ready by the time it's needed.

Another addition to mod_pagespeed 1.2 is the ability to fetch and optimize resources from outside domains. For domains that don't apply mod_pagespeed, this means you can get the same performance benefits for those outside files as well. It's also recommended to serve all the content from the same domain if you use SPDY.

Finally, convert_jpeg_to_progressive is a "core" filter in mod_pagespeed 1.2. Large JPEG images will be converted from baseline to progressive, which should result in a file size reduction in the fast majority of cases.