Mastering C# and Unity3D

Flash Player 10.2 Performance: Part 2

Today’s article follows up on last week’s article that began by running many of the performance tests on this site with the newly-released Flash Player 10.2. Last week I got through half of the performance tests I did in my Flash Player 10.1 followup (see part 1, 2, 3, 4, 5, 6) and today I’ll cover the second half. What faster and what’s slower in Flash Player 10.2? Read on for a ton of performance test updates!

As you can see from the “Changes” column, there are a lot of differences in Flash Player 10.2 related to arrays and my linked list implementation. Arrays are faster on nine functions and slower on five for a net performance gain. My linked list implementation was faster on seven functions and slower on nine for a net performance loss. Directly, this is a good result as Array usage is far more common than my custom linked list class. Indirectly, it shows a net loss for AS3 classes. Overall, the result here is yet-again mixed.

Note that the implementation of as3signals here is the original version from the article, so as to maintain consistency. Later versions may alter the performance for better or worse. As for the results, as3signals seems to have gotten a little slower and events—at least with 10 args—seems to have gotten a little faster. It’s surprising that as3signals—with heavily uses Function objects—got slower and plain Function didn’t, but it must have been related to another implementation in, at least, that version of as3signals. On the other hand, there’s a nice performance boost for anyone (everyone?) using Event.

Vector.sort was unchanged and the fastest method—Array.sortOn—got slower, but the manual methods—quickSort and shellSort—got faster. Overall, I’d call this a loss as the fastest method is slower in 10.2.

There’s no real change here. For int, uint, and Number, toString is still a bunch faster than concatenation or the String() conversion function. For Array and Vector, a for-in loop is still the fastest way.

Arguments Slowdown

We saw it in part one of this series and we see it again: var args has been amazingly sped up! There’s virtually no penalty to using var args anymore, whereas it used to be about 30x slower. This was probably due to an array allocation behind the scenes that has since been removed. As for the arguments keyword, we see that using it is still just as painful as it was in 10.1. The recommendation is clear: use var args!

Variable Ordering

Both kinds of local variable access are faster in 10.2, but the local variables declared later has widened its performance gap with local variables declared first to the extent that it’s now about 15% faster.

More To Come

I’ll reserve any general conclusions until the series has concluded, but for now the performance is quite mixed. Stay tuned for the third and final article!