Posts Tagged bytearray

Building Strings

Tags: , , , , ,

When a recent comment asked about string concatenation performance, I realized that there are a lot of ways to build strings in AS3 and I hadn’t tested any of them. Leaving aside the sillier ones like the XML class or joining Array objects, we have two serious contenders: the lowly + operator (i.e. str + str) and the ByteArray class. Which will triumph as the ultimate way to build strings quickly?

Read the rest of this article »


Vector vs. ByteArray

Tags: , , , , , ,

Which is the fastest way to store data: Vector or ByteArray? Given that you can upload both types to Stage3D in Flash Player 11, this question has never been more relevant. So which should you use to maximize your app’s speed? Read on for the performance testing.

Read the rest of this article »


Serialize Anything: Part 2

Tags: , , , , , , , , ,

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.

Read the rest of this article »


Serialize Anything

Tags: , ,

The ByteArray class, introduced in Flash Player 9, has a pair of very powerful functions alongside all the usual ones like writeInt. It actually allows you to read and write AS3 objects and provides an easy, fast, and compact way to serialize anything without writing any code. Today’s article explores shows you how to harness the power of these functions to improve your data serialization and deserialization.

Read the rest of this article »


The Size of Empty

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

I was reminded about the flash.sampler API by Grant Skinner’s recent post about it. While only available in the debug player, it can still tell us some valuable information about what goes on in the release player. Today I’m using the getSize function to find out how much memory overhead various classes impose, even when they are empty.

Read the rest of this article »


Map Performance

Tags: , , , , , , ,

I recently received an e-mail from Dmitry Zhelnin (translation) with a test he did concerning the speed of a couple ways to get a value for a key, which I like to call a map and Wikipedia likes to call an associative array. I’d been meaning to do a similar test for a while now and, guess what, I finally have! UPDATE: fixed miss test for fixed-size Vectors.

Read the rest of this article »