Actually, Tyler's tests proved that "var a in" is faster with today's
player. I tried his test out myself and my results were even wider than
his. I published for AS2 and ran in Flash Player 9. I was averaging
roughly 265ms for "var a in" and 275ms for "(--a -(-1))".
Then I compiled for AS3 and it ran too fast for testing at 7ms for
both!!!! AS3/Player 9 rocks!!!
So, I added another 9 to the loop counter making it 99999 iterations.
Then "var a in" ran at 70ms, (--a -(-1)) and (a--) ran the same at 77ms.
Then I added another 9 making the loops 999999. "var a in" ran at
740ms, (--a -(-1)) ran 765ms and (a--) at 770ms.
I'm satisfied that "for (var a in array)" is faster than "while (--a
-(-1))". Perhaps in the past that wasn't always the case, but with
player 9 it is the case and that's what I'll be basing my decisions on.
James O'Reilly
http://www.jamesor.com
Steven Sacks | BLITZ wrote:
using a for..i..in loop will always be faster
It's been proven before here on flashcoders that for in is not faster
than --a -(-1) because it compiles to more lines of pcode. I guess it's
time to use Flasm to bust out some pcode and post it here on the list
instead of making claims based on hunches and past posts in the
archives.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com