Joa Ebert has a nice PDF about optimization techniques: http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/- pretty good to see the benchmarks on casting arrays and 2d loops. On Tue, Jan 27, 2009 at 6:17 PM, simplychaos <[email protected]> wrote:
> > @JLM would be interested in using Haxe, but unfortunately most of the > stuff I do is for work and I am limited to AS3 compiling in CS3/CS4. > > @katopz: Interesting site, I believe some of their tests have flaws, > but it does give some other options to consider. I will have to test > some of those loops against linked lists, which I believe will still > be faster because there is no array unboxing. > > On Jan 26, 8:51 pm, katopz <[email protected]> wrote: > > > any chance you'd accept a patch if I'm able to make it work? > > > > sure! just prove it work, fyi, do try this also > > > > http://businessintelligence.me/projects/performance_tester/performanc... > > > > cheer ;D > > > > 2009/1/27 Justin Lawerance Mills <[email protected]> > > > > > > > > > > > > > Did you try using Lambda.map in haxe for sake of argument/comparison, > its > > > possible to not use a loop at all, but I guess its really looping just > in > > > more optimal way. For instance I was creating a simple tweener class > the > > > ot]her day, and used Lambda to map the properties to their new values, > its > > > just a concept class so it works but is v.basic but if anyone wants it > to > > > get more grip on mapping i can send it. Not currently using away, but > Rob > > > mentioned he was looking at haXe. > > > > > cheer justin > > > > > On 26 Jan 2009, at 22:05, simplychaos wrote: > > > > >> I was wondering if there are any plans to use linked lists for > > >> iterating through all the various meshes, primitives, lights, etc... ? > > >> It seems like Dictionary is used for everything, but according to my > > >> speed tests linked lists are quite a bit faster. I'm not sure how much > > >> of a boost it would really give but for 5,000,000 iterations here are > > >> my numbers: > > > > >> linked list: 37ms > > >> for loop: 67ms > > >> dictionary: 179ms > > >> while: 38ms > > > > >> Here's the iteration code I'm using: The array, linked list, and > > >> dictionary are already built before timing. obj is a typed variable > > >> that has a "nxt" variable to point to the next object in the list. > > >> These numbers are from FP10 release version; numbers are similar with > > >> debug version, but all slightly slower. > > > > >> var time:uint = getTimer(); > > >> for (i=0; i < len; ++i) { > > >> obj = list[i]; > > >> } > > >> time = getTimer() - time; > > >> trace("for loop: " + time); > > >> debugText.appendText("for loop: " + time + > "\n"); > > > > >> time = getTimer(); > > >> obj = list[0]; > > >> var val:Number = 0; > > >> while (obj = obj.nxt) { } > > > > >> time = getTimer() - time; > > >> trace("linked list: " + time); > > >> debugText.appendText("linked list: " + time + > > >> "\n"); > > > > >> time = getTimer(); > > >> for each (obj in dict) { > > > > >> } > > >> time = getTimer() - time; > > >> trace("dictionary: " + time); > > >> debugText.appendText("dictionary: " + time + > "\n"); > > > > >> time = getTimer(); > > >> i = 5000000; > > >> while (i--) { > > >> obj = list[i]; > > >> } > > >> time = getTimer() - time; > > >> debugText.appendText("while: " + time + "\n"); > > > > >> This may not have a huge impact, but I thought I'd throw it out there. > > > > -- > > katopzhttp://www.sleepydesign.com > -- ~Gabriel Laet
