12 May 2007 JavaOne – AJAX performance tuning
In a common theme from JavaOne, it appears you need to be spruiking a product to get a gig as a presenter, so I was almost lulled into a false sense of security when I went to a session on AJAX performance. The presenter went through some interesting aspects of AJAX performance, and I will highlight them here.
Reducing Start-up Time
In addition, you can reduce start-up time by making the file smaller by removing white space and comments. There are some tools that can do this (Dojo, safe compress), with the major caveat that you need to ensure all lines end with a semicolon since these tools remove the carriage return and some script relies on carriage return to indicate the end of the line.
Finally, if the file can be gzip’d then this will also reduce the start-up time. Most newer browsers can support this (HTTP 1.1 with stated gzip support), but you will probably need some client and server script to detect the browser and see if you can provide the compressed version.
(He also suggested distracting the user with flashy graphics, but I don’t think that is a technical approach – leave that to the Project Manager to suggest)
Reducing Run Time
There were a few technical hints to speed up actual code (such as using native DOM parsing in the browser, that string comparisons in IE are 4 times slower than Firefox) but at this point the presentation mostly turned into the product spiel for jsLex (darn! another spruik) which will help you run tests against your code and identify poor performance areas. This seems to be pretty helpful, and is probably worth a look if you need to optimise AJAX code.
Craig BakerPosted at 21:28h, 16 May
I would have enjoyed this presentation. Just spent a good part of my evening monitoring AJAX related HTTP requests on Tangler. Problem is we are using all of the recommend techniques highlighted above but speed it still an issue.
I would also add that CSS can add wieght to the page, so using a combiner servlet and compressing CSS can help.
Cache is also a big one, configuring the correct cahce settings in the HTTP response headers will dramatically increase subsequent page loads.