Today’s article is the conclusion of my series on Flash Player 10.0 versus Flash Player 10.1 performance. If you haven’t yet read the first, second, third, fourth, and fifth articles, that’s a good place to start. If you have, read on for the finale!

Introduction

This part’s performance methodology will be the same as first, second, third, fourth, and fifth articles, so let’s get right to the comparisons.

String Conversion

Original Article

Flash Player 10.0

Type String() Concat toString() toString(10) join() for loop
int 2 262 328 328 n/a n/a
uint 2 262 330 330 n/a n/a
Number 2 282 323 324 n/a n/a
Boolean 2 2 9 n/a n/a n/a
Array 5901 5886 5861 n/a 5507 3782
Vector (int) 5364 5379 4975 n/a 5127 3834

Flash Player 10.1

Type String() Concat toString() toString(10) join() for loop
int 2 1 196 194 n/a n/a
uint 2 2 194 201 n/a n/a
Number 1 1 199 190 n/a n/a
Boolean 2 2 9 n/a n/a n/a
Array 2659 2671 2640 n/a 2633 1465
Vector (int) 2493 2490 2265 n/a 2250 1389

First off, concatenation of int, uint, and Number has gone from 262-282 to 1-2, which is a huge speedup. While not quite as huge, all other string conversions seem to have roughly doubled in speed. These are some great performance increases across the board!

Arguments Slowdown

Original Article

Flash Player 10.0

Environment Plain (1) Var Args (1) arguments (1) Plain (25) Var Args (25) arguments (25)
Flash Player 10.0 10 379 493 21 825 1148
Flash Player 10.1 10 (1x) 191 (1.9x) 437 (1.1x) 21 (1x) 639 (1.3x) 1067 (1.1x)

Again, there are speedups here across the board. This time they range from 1x (undetectable at small timing) for plain functions to 1.9x in the extreme case. Since var args and arguments are both important and often-used language features, this should come as a welcome speedup to many AS3 apps.

Variable Ordering

Original Article

Flash Player 10.0

Environment testIFirst testILast
Flash Player 10.0 6876 6939
Flash Player 10.1 7399 7501

While the relative difference between variable orderings remains roughly unchanged—putting frequently-used variables first helps very slightly—the overall times have increased in Flash Player 10.1 by about 8%. Local variables are extremely common and the fastest way to access a variable, so it’s a real shame to see their speed drop for seemingly no reason.

Conclusion

After six articles of performance comparison between Flash Player 10.0 and Flash Player 10.1, one thing is certain: the performance differences are a definite mixed bag. Even in today’s tests we saw two across-the-board speedups and one across-the-board slowdown. It’s very important to keep in mind the relative weight to give each of these tests when trying to decide if Flash Player 10.1 represents an overall speedup and can flatly be described as “faster” or “slower” than Flash Player 10.0. The performance articles on this site aim to look very closely at the differences in different approaches, or in this case Players, so that the AS3 programmer can make more knowledgeable decisions to optimize Flash apps. So if you’re looking for the nitty gritty, read back over the first, second, third, fourth, and fifth articles. If you’re not, here are some performance generalizations:

Method Speed Change Importance Notes
Object allocation 2x-3x faster Major Free lists still 5x faster
Loops 2x faster Major Some types exhibit more modest speed improvements
Shapes and Sprites 1.5x faster Major 40% less memory too
Function Calls Through Objects 25-50% slower Major Calls through super not slower
Getters and Setters 50% slowdown Major
Mapping Classes 50% slower-50% faster Major Results extremely mixed. Array and Vector notably slower (19-33%)
Events 1.2x faster Major Still much slower than TurboSignals
Local Variables 8% slower Major First variables still slightly faster
Calls through Function variables 3.5x faster Average
Try/catch 1.5x-3x faster Average No longer any slowdown
Var Args 2x faster Average
Math functions 1.1x-2x faster Average Inline versions often much faster
BitmapData Mostly 0-30% faster Average Some functions massively faster, others slower
Graphics.lineTo() 8-167% faster Average
Decrements 17% faster Average
Var Args and Arguments 1.3x-1.9x faster Average
Namespaces 25% slower Minor
Building XML 6.5x faster Minor
Regular Expressions 30% faster Minor
Math.isNaN() 70% faster Minor Inline version still much faster
Backwards Loops 17% slower Minor
Linked Lists 1.15x-2.58x faster Minor
Sorting Vectors 1-46% faster Minor Array.sortOn() still much faster
Math.ceil 2x faster Minor Inline version still 1.8 faster
Conversion to String 2x faster Minor Concatenation is wildly faster

Among the tests I marked “major”, there are big speedups and big slowdowns. While it’s certainly awesome to have 2x-3x faster object allocation, 2x faster loops, 1.5x faster Shapes and Sprites, and 1.2x faster Events, it’s also a huge letdown to have 25-50% slower calls through Function variables, 50% slower getters and setters, 19-33% slower Arrays and Vectors, and 8% slower local variables. So is this faster or slower overall? With such varied results, the answer must ultimately depend on where your program’s bottleneck lies. Overall though, I’d say most Flash apps should be a little quicker with Flash Player 10.1.