In last week’s primer on the new domain memory (“Alchemy”) opcodes the initial test showed that they couldn’t match the performance of good old `Vector`

when writing out a lot of float/`Number`

values. Today’s article expands on that test to check the performance of writing integers and the performance of reading integers and float/`Number`

values. Can the domain memory opcodes redeem themselves? Read on to find out.

## Posts Tagged int

Strings and integers sort differently. Unfortunately, this became a problem for me during some recent experiments with Starling. It could be a problem for you too in a variety of situations. Today we’ll look at a workaround I’ve developed to solve this problem, which isn’t nearly as straightforward as you might think.

Behind the scenes `Array`

holds its values in two ways: a densely-packed array at the beginning and a sparsely-packed map after that. This means it can be used as a map where the keys are indexes and not take up a huge amount of wasted space. `Dictionary`

can also have `int`

keys. Which is faster? Today we’ll find out!

This is an extremely common task: converting a `Number`

to an `int`

. There are a *lot* of ways to do it, but which is fastest in AS3? Today we’ll look at a performance test app that attempts to find the fastest way to accomplish this. The answer just may surprise you!

`Math.abs`

is a commonly-used utility function for taking the absolute value of a `Number`

. However, there’s no special-case version for taking the absolute value of an `int`

. Of course `Math.abs`

will work for `int`

values, but we can do it faster. Read on for a couple of ways.

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.

If you’re thinking “I know what an `int`

is”, you need to take this little quiz to find out for sure!

Logical operators are necessary in every app, so it’s unfortunate that they are so slow in AS3. That’s why I was happy to see a potential alternative in a recent comment by Skyboy. Today’s article shows you how to do logic faster by avoiding logical operators (e.g. `&&`

) and using their bitwise (e.g. `&`

) operator counterparts instead.

AS3 has two integer types: `int`

and `uint`

. In my experience, most AS3 programmers just use `int`

everywhere and ignore `uint`

. This is usually acceptable as the need for unsigned integers is rare compared to their signed counterparts. However, there are significant performance differences between the two. Read on for the impact of `uint`

on your loops. **The original version of this article’s performance test contained a small-but-critical error that led to a lot of incorrect analysis and results. This version of the article has been corrected.**

Five months ago I said I’d talked about explicit type conversion. I hadn’t, really. What I talked about before was type *casts*. A cast changes the type, not the data. Today, I’m actually going to talk about type conversion and show you the costs of converting between all of your favorite types: `int`

, `uint`

, `Number`

, `Boolean`

, `String`

, and even `XML`

.