Box2DFlashAS3 optimizations for AVM2...

I thought I'd start this thread for those who are interested in helping optimize the engine for flash. Specifically, I thought it would be a good idea to break up the work involved to lessen the workload and also to avoid duplicate changes.

With that in mind, who is interested in helping? I have some links that might whet anyone's appetite who is, and help to refine the focus of those who aren't sure.

http://www.scribd.com/doc/8799584/Optimizing-AirFlash-Applications-Sean-Christmann
http://www.scribd.com/doc/9704440/Actionscript-Virtual-Machine-2-AVM2-Overview-and-Opcodes
http://businessintelligence.me/projects/performance_tester/performanceTester.html

That's it for now.
john_smith also expressed some interest. I don't mind doing some work either, though I wouldn't describe myself as "interested".

As I said, first step is to produce a testbed to measure performance by.
Then rewriting code to make better use of linked lists, and reduce allocations, etc. Box2D contains some horrendous allocations in some places, because cheap bitwise copies in C++ have been ported to new objects and dozens of assignments. Pooling/inling will fix a lot, but the best results would be from manual escape analysis to avoid copying. Similarly, performances of arrays are very different. Only then would I turn to nitty gritty like your papers suggest.

Array -> Vector would be a fairly cheap win, too, though it might be necessary to keep support for Flash 9 for a while still.
Quote:
Array -> Vector would be a fairly cheap win, too, though it might be necessary to keep support for Flash 9 for a while still.


This was going to be my next area of inquiry really, if we could make a flash player 10 version of Box2dAS3 I'm sure performance could be raised quite easily... but like you say it would stop anyone from using it in flash player 9.

I agree that fixing up the port into something better suited for AS is a good idea, just not as much fun right? heh.

Where I was planning on starting my focus was the broad-phase. Since its designed to be plugged in, a flash player 10 version could be substituted instead for those who can use it. However, now I think I'll have to put that part off and start on the cleaning up of those allocations like you mentioned.

Thanks for your 'interest' too, a good first step in getting more. (I'm being serious btw, not making fun)
I've actually made a few optimizing changes to the broadphase recently. But Erin's stated he's replacing the current one, so I wouldn't touch it now.
Try to stick to the solver and contact processing - it seems that's where the actual bottlenecks tend to lie.

Original thread: https://box2d.org/forum/viewtopic.php?t=3014