Posts Tagged int

How Big Is That Class?

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 entry »

Tags: , , , , , , , ,

5 Comments

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

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 entry »

Tags: , , , , , , , ,

8 Comments

String Keys vs. Int Keys

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 entry »

Tags: , , , , , ,

5 Comments

Using Non-String Keys with Object

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 entry »

Tags: , , , ,

6 Comments

The Four Vector Classes

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 entry »

Tags: , , , , , , , ,

3 Comments

Domain Memory Opcode Performance: Reading and Writing

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.

Read the rest of this entry »

Tags: , , , ,

9 Comments

String-Sortable Integers

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.

Read the rest of this entry »

Tags: , , , ,

7 Comments

Maps With Int Keys: Array vs. Dictionary

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!

Read the rest of this entry »

Tags: , , , , , , , ,

7 Comments

Converting Numbers to Ints

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!

Read the rest of this entry »

Tags: , , , , , , ,

13 Comments

Faster Math.abs

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.

Read the rest of this entry »

Tags: , , , , , ,

18 Comments