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!
Posts Tagged object
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.
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.
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.
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.
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.
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.
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!