When I first wrote about master strings I proposed a function that would help to trim them down and potentially save a lot of memory. However, that method still resulted in a string with a master string one longer than it. Ideally, we’d have no master string at all. Since then, three astute readers chimed in with alternate solutions to the problem. Today I put try all three out to see which method does the best job of cleaning master strings.
Archive for category AS3
Function calls in Flash are notoriously slow. Recursive algorithms require lots of function calls by definition. So are iterative versions faster? Today’s article explores whether or not it’s worth converting your recursive algorithm into an iterative one.
Given that Object
and Dictionary
can have int
keys and that int
keys are faster than String
keys, a natural performance test follows: which class is fastest at reading from and writing to those int
keys? Is there a difference between the four Vector
classes? Today’s article performs just that test and comes up with the answers.
Now that we know you can use int
keys with Object
, it’s time to test whether or not this is any faster than String
keys. Today’s article does just that and also tests int
and String
keys with Dictionary
.
Pop quiz: what’s the difference between an Object
and a Dictionary
? If you said “Dictionary
can have non-String
keys”, you bought into a common myth. Today’s article shows the cases where the lowly Object
class will use non-String
keys whether you like it or not. Read on for the details.
I’ve recently been notified of a way to dramatically speed up for-in
loops. I’ve tested this method out and indeed there is a 5x speedup. Employing the technique is also really easy. Unfortunately, the speedup is sometimes an illusion. Read on to learn a little more about for-in
loops and how you could potentially speed yours up by 5x.
Sometimes the old, legacy option is faster than the new one you’re supposed to use. That happens to be the case with XML in Flash: XMLDocument
is quicker than XML
. Today’s article tests its performance to figure out just how much faster it is and if it can keep up with plain Object
and typed class
instances.
If you deal with XML documents, you probably appreciate AS3’s support for the E4X operators. These make it really easy to access the XML
class like any old object with the .x
(dot) operator as well as XML-specific operators like ..x
for descendants and @x
for attributes. Even fancier, there’s support for arbitrary expressions like .(@id == "123")
. With all this convenience we should wonder- how slow are the E4X expressions?
We know that the XML E4X operators are an 10x slower than plain Object
, but how slow are they compared to the XML
class’ methods like elements()
and attributes
? Today’s article finds that out.
Your computer has RAM, but it also has much faster forms of memory. If you want your app to run quickly, you need to be aware of these other memories. Today’s article discusses them and shows two AS3 examples that, even with such a high level language, you can still take advantage of them.