Tag Archives: Google Inc.

Google Closure Compiler?

Yes, it’s a question! After reading about jQuery version 1.4 I saw something that seemed to be pretty interesting to me. jQuery is now using Google Closure Compiler to minify and compile it’s source. The result was smaller output file.

Now I’m using YUI Compressor for my project and when I decided to make an experiment with Googles’ software it was just because I’d like to gain loading savings. In the project I’m working on I use two famous JavaScript libraries: jQuery and OpenLayers, and the result was really good. The compiled code was smaller than the YUI compressed source and the savings where more than 50% for non-gzipped requests.

The problem is that the resulting code, even successfully compiled after what Google said, was producing errors on the site and wasn’t working correctly. That why I’m leaving the title as a question and I’ll continue my experiments with this approach until I get any good results.

Optimizing OpenLayers. Make it smaller and faster!

In breve OpenLayers is a open javascript library that gives you the power to integrate, work and develop map based web applications as is Google Maps.

The problem is that the library supports so many protocols, controls and tools that you probably never use in your application and because of this the size of the resulting, compressed javascript file is around 700K, which is too big for any javascript file at all. That makes your site slow and the user experience is really awful!

The solution is to cut that functionality that you don’t use, which is not so easy. You’ve to be careful doing this, just because you can crash you application by removing something that seems to be useless but in fact isn’t.

I’ve used this technique and managed to make the resulting javascript file up to 400K. And this is really simple – just add the files your application don’t need to the .cfg file you use for compression. Usually this fils is in the /build directory of OpenLayers.

Even more – I’ve seen some other developers managing to reduce the size up to 300K and that’s more than twice which is really very good result.

The other thing I’d like to do with that library is to explore with care the code inside and to optimize anything I can. There are too many style reflows in some classes and that’s what’s visible on the first look. I suppose there are much more things to optimized in it.

I’ll start doing my research and optimization and I’ll let you know what happens in numbers!