Very cool. Nice improvement.
In a sense, any loop based on Duff's Device is going to be somewhat
difficult to follow for anyone encountering it for the first time, so I
wouldn't worry about that. Anyone using this kind of optimization isn't
going to be terribly worried about the clarity of their code anyway!
:-)
I will add this to the one on my site, if that's ok with you...
Jeff Greenberg
[EMAIL PROTECTED]
Daniel Aborg wrote:
> 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
>
>
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev