This post originated from an RSS feed registered with Java Buzz
by Fred Grott.
Original Post: Flashlite Loop optimizations, I can loop can you?
Feed Title: ShareMe Technologies LLC-The Mobile Future
Feed URL: http://www.jroller.com/shareme/feed/entries/rss
Feed Description: A Weblog about Java programming and digital convergence on mobile devices in such areas as P2P and collaborative technology.
Remember, few posts back where I hinted at that flashlite optimizations might be the same as MIDP 1.0/J2me optimizations? Basically, every MIDP 1.0 optimization used in midp 1.0 games can be used in flashlite 1 and 2.
For example, set the freaking variables before and outside the loop where they will be used. If you wan tot see the difference in bytecode operations examine it using flasm and you will see a huge decrease in stack operations.
Remember, fl1/fl2 VMs are stacked based without any JIT like J2me MIDP 1.0 VMs. That means that certain code structures written the OOP way will always produce bloated code when you look at the byte code on the stack. Arrays, loops, and etc.
And the fastest loops are those that count in the negative from say 1000 to 0. Why? Has to do with how stacks work in the flash world.