So, time to dig up my old F9/AS3 speed test files. Run the same test swf in standalone version (non-debug) of both latest FP9 and new FP10. Swf is published as F9/AS3. WinXP.
HitTests 100000 cycles:
FP9 -
hitTestObject: 334 ms
hitTestPoint pixels: 453 ms
hitTestPoint box: 381 ms
calculate distance: 280 ms
FP10 -
hitTestObject: 155 ms - 2 x times faster
hitTestPoint pixels: 186 ms - 2.4 times faster
hitTestPoint box: 147 ms - 2.6 times faster
calculate distance: 95 ms - 2.9 times faster
FP10 looks to be at least 2 times faster.
I thought maybe its the random and sqrt functions I used in hittest file, so I ran test with only calculating Math.random and Math.sqrt
Math.random 1000000 cycles: FP9 - 104 ms FP10 - 102
Math.sqrt 1000000 cycles: FP9 - 174 ms FP10 - 191
Same "for" loops are used, elements are accessed like this:
Array1[i][j]
Array2[i*w+j] //w is the "width"
Object3[i+"_"+j];
Then it measured time to go through all elements using "for..in" loops.
And finally it measured time to go through all elements using "for each in" loops.
Times cycled: 100000
Double for loops
Two-dim Array1: 95 ms
Flat Array2: 140 ms
Object: 2478 ms
for in loops
Two-dim Array1: 1597 ms
Flat Array2: 1070 ms
Object: 393 ms
for each in loops
Two-dim Array1: 209 ms
Flat Array2: 61 ms
Object: 67 ms
Posted only FP10 results FP9 performed practically same.
I dont have CS4 yet so I cant compare Vector with Array, I expect it to be faster but not like 10 times faster. If its 10-20% faster compared to Array, its still good.
Plus, I think Vector is not supported in FP9 at all. You can only use it if you publish for FP10.
This test compared undefined, Number, uint and int type of variables in simple operations of addition, subtraction, multiplication and division. Times cycled: 10000000
Well, Number and undefined performed same in both FP versions, so here are FP10 results only:
Number +: 102 ms
Number -: 101 ms
Number *: 109 ms
Number /: 242 ms
Number total: 554 ms
undefined +: 588 ms
undefined -: 403 ms
undefined *: 448 ms
undefined /: 574 ms
undefined total: 2013 ms
However int was slightly and uint a lot faster in FP10:
FP9 -
int +: 61 ms
int -: 59 ms
int *: 72 ms
int /: 407 ms
int total: 599 ms
uint +: 58 ms
uint -: 58 ms
uint *: 71 ms
uint /: 674 ms
uint total: 861 ms
FP10 -
int +: 45 ms
int -: 44 ms
int *: 62 ms
int /: 408 ms
int total: 559 ms
uint +: 46 ms
uint -: 44 ms
uint *: 63 ms
uint /: 424 ms
uint total: 577 ms
nice comparisons tonypa. Did you also try math operations with bitwise operators?
Overall i´m glad that the release f10 player seems to be doing really well performancewise, its no giant leap but a nice slight improvement.
What could become quite interesting is when one does math operations etc using pixel bender cause then they can run in an own thread, not take away from the performance of the rest of the app and in general run quite a bit nicer.
I still think its ugly to have to use an own C syntax derivate for that stuff but yeah, could lead to cool stuff.
Which math operations you had in mind, like I said earlier, random and sqrt were at same speed and uint type performs better in FP10. These have all been swfs published as F9, now FP9 cant use Pixel Bender so how would you compare them?
regarding the math operations doing em with bitwise operators where possible has been faster for quite a while so i was curious if that is now even faster or still pretty much the same.
regarding pixel bender: yeah, can´t make a direct comparison there between f9 and f10 player, though yeah, we´ll surely see various things on that end that act quite nice for flash standards.
This test is perhaps more interesting for games. Here we move number of clips on stage for 100 enterFrame steps and measure total time spent. First we use separate movie clips with vector rectangle, then separate clips with bitmap graphic and finally one bitmap with copyPixels:
1000 Clips / fps set to 50
FP9 -
Vector graphics: 7873 ms / 13 fps
Bitmap graphics: 2518 ms / 40 fps
One bitmap with copyPixels: 2625 ms / 38 fps
FP10 -
Vector graphics: 8018 ms / 12 fps
Bitmap graphics: 2383 ms / 42 fps
One bitmap with copyPixels: 2310 ms / 43 fps
FP10 performs even worse with vector graphics, bitmaps are drawn faster. Not sure why FP9 is faster with separate bitmap clips.
The article analyzes MacOS and Linux performance increase in detail but there are also Windows benchmarks... the performance gap between the Windows version of the FP and the "rest of the world" remains almost unchanged.