Today’s article is about the basic operators that make up most languages, and in particular AS3. Without them there wouldn’t be much of a language. So it would seem vitally important that we know how they perform relative to each other. Is shifting faster than adding? Adding faster than multiplying? Multiplying faster than dividing? Does the type of the operands matter? Read on for the results in high detail. Update: see my comment below for an important change to the results.
Archive for category AS3
One of the first articles I wrote for this site covered the two types of casts available to the AS3 programmer. In that article I covered the syntax of the two as well as some of the quirks. Today I’ll cover the performance differences between them.
Sizable applications are often in need of externalizing code from the main application. Often times this is done via a library or framework and it is well understood in the Flash community how to use these in our applications. What is less-understood is how we can go about delegating some parts of our applications to plugins. Read on for a simple technique to get plugins into your Flash application.
I wrote an article last November showing how to make your isNaN()
calls 12x faster. Today, thanks to a tip from the comments on that article, I’ll show you how to make your isNaN()
calls even even faster! (UPDATE: see the definitive article on isNaN for much more!)
An absolute fundamental of programming is the concept of logical operators like &&
and ||
. In a recent comment, Chris H pointed out that MXMLC doesn’t do a particularly good job generating bytecode for these operators. Today I’ll look further into the subject and see just how much this impacts performance.
As a followup to the previous article about object creation and a comment about an alternate object creation strategy, today’s article will expand the coverage of object creation. I will also discuss the performance (and generated bytecode) for creating non-empty objects to see if there are any redeeming factors to the “curly braces” (o = {}
) approach.
A comment posted before the Flash Player 10.1 series of articles asked about the performance differences between creating an object with o = new Object()
and with o = {}
. Below I’ll look into the generated bytecode for these two approaches and test their relative performance to see if either approach is faster than the other.
Now that the Flash Player 10.1 testing is through I can return to a comment asking about the performance difference between if-else
chains and the ternary (? :
) operator. Further, I’ll discuss switch
statements to see if there is any difference in performance for these commonly-used methods of flow control.
Part five of this series on Flash Player 10.0 versus Flash Player 10.1 performance continues re-testing performance articles just like the first, second, third, and fourth articles did. Read on for more performance comparisons!