I wrote an article last summer about with blocks, but really only touched on basic usage. Today I’ll delve into their internals a bit and discover some surprising aspects.
Archive for category AS3
I recently had the need to cancel a callback function that I had passed to an API. The API had taken my callback function directly, so there was no way to remove the event listener. So I thought back to an old article I wrote and came up with a solution. Read on for a utility function that will allow you to cancel function callback in AS3 as well as JavaScript and AS2.
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.
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.
I’ve been looking at a lot of AVM2 bytecode recently with the excellent Nemo440 AIR app. Some of the code was using my inline Math.ceil() function and I noticed that the int() cast is implemented like any other function call. Today’s article will show you how to optimize the inline Math.ceil() call even further by avoiding this function call.
Today’s article is in response to some interesting comments on the previous article comparing Array‘s performance to that of Vector. Today I’ll test different types of Vectors and the performance of deleting elements.
Amazingly, I’ve never done a straight shootout between Vector and Array on this site. It’s a simple test, so read right on to see what kind of added performance you can get by using Flash 10’s Vector.
Anybody who has ever had a performance problem with a graphically-rich Flash app has seen the “Show Redraw Regions” option in the debug player. Well, at least I hope they have since it’s right there in the context menu and there’s even a function call to toggle them. Normally it’s pretty straightforward what gets redrawn and when, but when you start to mix in advanced features like scrollRect and cacheAsBitmap, things get complicated. Today I’m going to cover a technique for eliminating some mysterious redraw regions.
This is a quick article to discuss a point brought up in a recent comment. Which is the fastest way to increment: j++, ++j, or j+=1? Likewise, which is the fastest way to decrement? Below I will dispel the myth that there is any difference between them at all.
Version 10.5 of Opera was released today. Opera 10.0 last performance test made some small strides over 9.64, but it was still the slowest current version of the browser out of the whole test. Also, Google Chrome was updated on January 25th and Mozilla released Firefox 3.6 on January 21st. Today’s article shows an updated performance comparison to check up on the progress being made by Opera, Google, and Mozilla.