Posts Tagged object

describeType vs. describeTypeJSON

Tags: , , , , , ,

flash.utils.describeType has been around since Flash 9 and is the standard way to find out interesting information about a Class type, including its metadata/annotations. However, there’s a hidden function called describeTypeJSON that provides an interesting alternative. Since describeType is notoriously slow, could describeTypeJSON be the speedy alternative we’ve been looking for? Today’s article puts them to the test!

Read the rest of this article »

7 Comments

When getSize() Lies

Tags: , , , , , , , , , , ,

flash.sampler.getSize() is a handy tool for figuring out how much memory a class instance uses. However, it is often flat-out wrong. Today’s article tries it out on a variety of classes to find out which ones it works on and which ones it doesn’t.

Read the rest of this article »

4 Comments

How Big Is That Class?

Tags: , , , , , , , ,

When you instantiate one of your classes, how much memory does it use? Today’s article tries out a lot of combinations and counts the bytes used. The conclusion is easy to remember and will give you a solid understanding of how much memory your app is using.

Read the rest of this article »

5 Comments

Four Ways to Clean Master Strings

Tags: , , ,

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.

Read the rest of this article »

6 Comments

Int Keys: Object vs. Dictionary vs. Array vs. Vector

Tags: , , , , , , , ,

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.

Read the rest of this article »

8 Comments

String Keys vs. Int Keys

Tags: , , , , , ,

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.

Read the rest of this article »

10 Comments

Using Non-String Keys with Object

Tags: , , , ,

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.

Read the rest of this article »

7 Comments

The Four Vector Classes

Tags: , , , , , , , ,

There are four Vector classes in AS3. It seems like there is only one—Vector—and that it supports generics, but that is only an illusion. Today’s article will do some tests to reveal the implications to your app’s correctness and efficiency.

Read the rest of this article »

3 Comments

If-Else Trees vs. Array and Vector

Tags: , , , , , ,

We’ve seen that if-else trees are way faster than Object, Dictionary, and even switch at key-value mapping, but how do they stack up against Array and Vector? Today’s article puts them to the test and uncovers some unexpected results.

Read the rest of this article »

8 Comments

450x Speed Up Copying Between Collections

Tags: , , , , ,

Programming in AS3 invariably involves choosing between various collections: Array, Vector, Dictionary, Object, ByteArray, and so on. What if you need to quickly copy between them? Your choice of collection could result in a 450x slowdown in your app… or a 450x speedup!

Read the rest of this article »

7 Comments