In my quest for squeezing as much performance out of flash as I possibly can, besides common speedy AS3 practices and smart programming, I’m looking into lower level speed boosts (as I’m hitting the limit with higher level).
For example, I use a LOT of arrays, and a lot of 2D, even 3D arrays;
I’ve always read that using a 1D array and the (y*width)+x formula was faster than array access of a 2D array. I’ve been using this method for a while. However I ran a test for myself
Each method with the same size “grid,” each node storing an Object with a variable called num with a random number, just to have something stored.
I ran speed tests for accessing this object in each node with as minimal amount of objects I could that would give a time over 0, up to 10 million, and many intervals in between. To my surprise, every time, the 2D array was faster. So I converted everything back. However, in my more realistic simulation, the different in frames/second didn’t seem very noticable.
Another issue, was that in most arrays, the datatypes are all the same, so I looked up the Vector. I replaced all the arrays I could with Vector.<type> hoping I would get the speed boost many articles were claiming. However, this still did not seem much different.
I’m using nested Vector’s though, Vector.<Vector.<type>>, which may defeat the purpose of hard typing? But I don’t see why.
Anyone have any input?