Beware of premature optimization

By crisp on Tuesday 28 November 2006 11:16
Category: Javascript, Views: 4.034

Recently Opera and the Microsoft IE-team posted some articles about javascript optimizations. Although these articles were written with the best intentions they should in my opinion have a big red warning-label saying "beware of premature optimization and browser-specific implementations".

Opera did a far better job than Microsoft in that respect providing tips that are fairly browser-independent wereas Microsoft made a very bad mistake providing tips that are mostly only beneficial to IE's specific implementation of javascript (JScript), or worse, tips that are IE-specific in itself.

Bear in mind that optimization on a certain level degrades readability and maintenability of your code so you should only resort to such measures when there is an absolute need to do so. In 99% of all cases this won't be necessary because you just don't need the few milliseconds saving. If you are in dire need of extra performance you should first reconsider the general design of your code and check for real bottlenecks such as overly use of abstractions that slow things down ($() for instance).

Volgende: Having fun with IE - part 2: CSS inheritance 11-'06 Having fun with IE - part 2: CSS inheritance
Volgende: Having fun with IE - part 1: getAttribute() 11-'06 Having fun with IE - part 1: getAttribute()

Comments

Comments are closed