Now that AS3 is performing slower than JavaScript in some areas, should we be looking to optimize our AS3 by offloading tasks to JavaScript? That may sound perverse, but the possibility of major speedups is tempting. Today’s article looks for speedups using Flash’s AS3-to-JavaScript bridge: ExternalInterface
.
Archive for category AS3
It’s been about a year and a half since my last test of AS3 versus JavaScript and there have been several major releases of both browsers and the Flash Player. Today, we pit every major browser against each other and Flash Player itself to get an updated picture of which provides the fastest scripting environment on the web.
String.charCodeAt
is a simple function so you might expect the function call overhead (huge in AS3) to making calling it frequently quite slow. You’d think that there’s no way an charCodeAt
-using AS3 function could beat a built-in String
function like indexOf
. Would you be right? Today’s article examines this special function to see if we might defy conventional wisdom and achieve a performance boost.
If-else trees have some of the best performance of any conditional code, including if-else
ladders, the ternary (? :
) operator, and the switch
statement. But how do they stack up against the O(1) lookups that Object
and Dictionary
offer us AS3 programmers? Today’s article finds out!
Surprisingly, some interesting things have been happening with conditionals like if-else
in AS3. First, a brand new AS3 compiler—ASC 2.0—has been released with the promise that it’ll generate more efficient bytecode. Second, some readers have pointed out the existence of a new (to me) technique: the “if-else tree”. Today’s article takes a look at just what that is and tests it against the classic options: if-else
, the ternary (? :
) operator, and the switch
statement. Which will be fastest?
Having covered JPEG-XR images recently, one thing has struck me as a little odd: there aren’t really any good cross-platform viewers available to look at them. Yes, it’s a bit of an obscure format, but shouldn’t there be something available? Well, I decided to make a simple Flash app to load a JPEG-XR image from a URL or a browse button and display it. Along the way I added support for PNG, JPEG, GIF, AVM1 SWF, and AVM2 SWF. Today’s article has the source code and the viewer itself. Added support for panning the image
Now that we’ve determined the best PNG compressors to create PNG images with, let’s delve into the world of JPEG compressors. As with PNG, we have multiple options to choose from in our Flash apps when we’re looking to encode images such as screenshots. Which is best? Today’s article delves into each compressor’s performance and file size efficiency.
Does the type of image matter when you’re compressing it to PNG? Does it affect performance? Size? This week’s article looks into these questions to find out how each of the PNG compressors performs on three different types of images: an icon, a photo, and random noise.
Flash Player has had built-in PNG compression since version 11.3. But how does it fare against all of the other PNG compressors out there? Does it compress faster? Does it produce smaller file sizes? Today’s article explores your options when it comes to compressing PNG files so you can get the fastest or smallest PNG possible.
Which image format is fastest to load? That was perhaps the most relevant question in last week’s article, so it’s time to explore it more deeply. Today’s article examines differences between different types of PNG, JPEG, and JPEG-XR files to answer questions like “does the JPEG quality setting matter?” and “is indexed PNG faster than full (ARGB) PNG?” Read on for the test and all the details.