[Home][Next: Part 1 - The Introduction]

Summary

Combine HTML, CSS-positioning, a Document Object Model (DOM) and JavaScript and you get what most people refer to as "DHTML". One thing DHTML can do is to move content around in the browser window. Repeat the movement several times and you'll get animation. With JavaScript's capabilities of continued function calls with specific delays you have an easy method of animated movement at a predefined pace.

After creating a couple of simple scripts to perform animation I was amazed by the appalling performance I saw. The movement was slow and rough. What I wanted was at least 25 frames pr second, which in turn makes the movement appear smooth to the viewer. I tried various delay-settings in my scripts, but I saw no better result.

Due to this lack of smoothness I sat down and created several scripts that would test various ways of moving a layer around and time how long it would take. Once I had functions I was satisfied with I tested them with several browser versions on 5 platforms: Windows 95, Windows 98, Windows NT, Linux & Apple. Some of these results were positive, some of the results were greatly disappointing.

Most home-owned computers today run either Windows 95 or Windows 98. It is also the operating systems that Microsoft wants the home users to have. My tests found that the users running this operating system would never see a smooth animation done in DHTML. According to a simple test these two operating systems are incapable of working with delays less than 53ms, which in turn means 18 frames pr second. The other three systems tested were easily capable of producing 50 or more frames pr second.

While trying to get the maximum performance out of my Windows 98 system I also compared animation using setTimeout() versus using setInterval(). I found that there was no increase in performance under Windows 98, but there was significant increase on the other operating systems used. The primary advantage of using setInterval() was that it gave more control over script execution speed.

The report gives accessibility to all tests performed, and listing of all test results (even those not mentioned in the report). Tests run under Netscape Navigator 4.x, and Microsoft Internet Explorer 4 & 5.

[Home][Next: Part 1 - The Introduction]

Morten Wang <warnckew@online.no>
Last modified 1999-11-07 01:57