ByteArray class is not as straightforward as you might think. In certain situations, it has surprising, undocumented functionality. Today’s article goes into some of these strange behaviors so you’ll get a better handle on exactly what’s going on behind the scenes.
Today’s article is both a reminder to optimize your algorithms and data structures before your code and a demonstration of the payoff you’ll get by doing so. By choosing the most effective algorithm and data structure to solve your problem you’ll reap huge rewards in performance. A 10x, 100x, or even bigger boost is easily attainable.
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.
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.
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.
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
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?