Hi,

Nice site, Jeff. Some interesting tricks there I hadn't thought about. I
liked the Duff's Device code, although I noticed it can be improved.
Here's a version of the code which doesn't have the case stuff in the
main loop but can still do a custom number of iterations. On my computer
I get these results in NS4.7 and similar results in IE5:

Ordinary: 601 ms
Duff's: 431 ms
Duff's Optimized: 250 ms

Of course, you'll only get a noticable speed improvement on this kind of
optimization when you're doing a huge amount of iterations with a loop
body which doesn't consume much time. And it's horribly unreadable code.

Cheers,

Daniel


Jeff Greenberg wrote:
> My new site (still under construction) is a collection of JavaScript
> optimization tips, techniques, tests and explanations. It will deal with
> speed, size and memory issues.

--
Daniel Aborg  <[EMAIL PROTECTED]> 
T: 0207 445 447  M: 07765 961 155
Title: Duff's Device Speed Optimization

Duff's Device Speed Optimization

  Status:

Ordinary Duff's Duff's Fast
Total: ms ms ms
Per Cycle: ms ms ms

Reply via email to