Posts Tagged number

What is an int?

If you’re thinking “I know what an int is”, you need to take this little quiz to find out for sure!

Read the rest of this entry »

Tags: , , , ,

5 Comments

Explicit Type Conversion

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.

Read the rest of this entry »

Tags: , , , , , , ,

4 Comments

Definitive isNaN()

I wrote an article in November 2009 titled Faster isNaN() and a followup to it titled Even Faster isNaN() and continue to get comments on both, so today I’m doing a followup to bring together both articles and the many comments on them into one definitive article. (UPDATE: added Windows performance results)

Read the rest of this entry »

Tags: , , ,

9 Comments

Implicit Type Conversion

I’ve talked before about explicit type conversion and used the function-call style (Type(obj)) and the as keyword to accomplish the task. Today, I’m going to talk about implicit type conversion and use—as implicit would imply—no operators at all!

Read the rest of this entry »

Tags: , , , , , ,

6 Comments

Even Faster isNaN()

I wrote an article last November showing how to make your isNaN() calls 12x faster. Today, thanks to a tip from the comments on that article, I’ll show you how to make your isNaN() calls even even faster! (UPDATE: see the definitive article on isNaN for much more!)

Read the rest of this entry »

Tags: , , , ,

9 Comments

String Conversion

It struck me recently that there are a lot of ways to convert variables of many types to a the String type. The ease of doing this is one of AS3′s strengths over languages where it’s error-prone, possibly insecure, and just plain difficult. The C language is the most obvious example of this and, since then, seemingly every language has enshrined string conversion in ways ranging from global String() functions (AS3) that take any variable to adding toString() to the base Object type (Java, AS3, others). AS3 seems to have chosen “all of the above” and there are now many ways to convert to a string. Below I’ll look at them from a performance standpoint and see if the everyday, run-of-the-mill boring string conversion can be improved by choosing one option over another.

Read the rest of this entry »

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

3 Comments

The Size of Empty

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

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

13 Comments