The hidden describeTypeJSON
function is faster than the XML-based describeType
function by default, but we can make it even faster. Today’s article describe just how this is done and achieves a nearly 10x speedup!
Posts Tagged XML
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!
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.
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.
AS3 has always had great support for XML built right into the language, but how fast is it? Today’s article compares the performance of operators that work on XML
objects like .@x
, .x
, ..x
, and ["x"]
against their equivalents in plain Object
instances and typed class
instances. Just how slow are the XML operators? Read on to find out.
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.
Dealing with XML files can very easily trigger Flash to “leak” memory. Your app may only keep a tiny fraction of the XML file’s contents, but the whole file may stay in memory and never get garbage collected. Today’s article examines how this happens and how you can clean up all that unused memory.
One of the new features in Flash Player 11 is a native JSON encoder/decoder class. In the Serialize Anything article, I neglected to add JSON as an option for serializing and deserializing arbitrary objects. In today’s followup we’ll take a look at the performance of the native JSON class and compare it to ByteArray.readObject/writeObject
and XML.