Speeding Up Frame Rates For DHTML Animation in Win98 - DHTML Lab | 8 | WebReference

Speeding Up Frame Rates For DHTML Animation in Win98 - DHTML Lab | 8

Logo

Speeding Up Frame Rates For DHTML Animation in Win98
A Case Study



Core Problems and Limitations With Standard and Multithread Scripting Methods

Whether one uses standard single thread techniques or the multithread techniques illustrated here, stability problems will occur. They can start rough, then smooth somewhat, but unwanted accelerations, decelerations and jerks remain. Some runs are worse than others. Setting the window object offScreenBuffering property to true doesn't help much. Unlike IE which is multithreaded, NN is single threaded so its poor performance isn't surprising with the multithreaded scripts. However, even though IE does accommodate these methods much better, its performance isn't as uniform as it could be and with "tri-threaded" codes is just unacceptable.

The multithreading model for IE is basically "apartment" threading but the scripting engines implement a limited threading, independent from the rest of the environment [5]. The setTimeout() and setInterval() methods provide the coarse rudimentary capability for this. This limited threading ability could easily account for IE's less than optimal behavior with two threads and poor behavior with more threads than that.

Overcoming these limitations would require that future versions of the Win9x OS use a faster hardware clock instead of the 55 ms resolution system clock to base off. WinNT and Win2K base off the memory controller in the chipset and have a 10 ms timer value. With Win2k+ eventually replacing Win9x, WinMe, etc., scripts would be able to take advantage of this faster timer [3],[11], giving up to 100 Hz updates which exceeds the ability of most PC monitors. Also, a more sophisticated version of the JavaScript engine could incorporate a better threading environment to deal with current speed and stability problems. Until things like this happen, we are stuck with a minor ability in Win9x to move page elements smoothly in DHTML. A solution could be to use techniques that go beyond the limitations of scripting alone. Packages like Macromedia's Flash [6] or Shockwave are optimized for creating animations, they're cross-platform, and have good development environments and common plugins for most browsers. Still, Flash and Shockwave cannot escape their containment box to interact with other page elements. They are not integral parts of a Web page like DHTML and offer only a partial solution.


Produced by Mark Szlazak and

All Rights Reserved. Legal Notices.
Created: July 11, 2000
Revised: July 11, 2000

URL: https://www.webreference.com/dhtml/column34/8.html