When you construct an Array
or a Vector
, you can specify an initial size. Why would you do this?There are various reasons you may want to reserve initially-unused slots for logic reasons, but are there any performance gains to be had by pre-allocating this space for an Array
or Vector
you intend to completely fill right away? Today I’ll take a look to see just how much performance can be gained by pre-allocating Arrays
and Vectors
.
Posts Tagged performance
Today’s article is about a hack. It’s a hack dedicated to improving the performance of helper functions, nested or not. you may not like the way the code looks, but you’ll love the speed!
It’s been about 9 months since my last test of AS3 versus JavaScript and there have been several major releases. I’ve held off on an update to this series since the two most widely used browsers—Internet Explorer and Firefox—have been approaching significant new versions. In the meantime, Adobe has released Flash Player 10.2 as we’ve seen in my performance update series (part one, part two, part three). Today, we pit every major browser against each other and Flash Player itself to get an updated idea of which provides the fastest scripting environment on the web.
AS3 has an interesting feature that is sometimes used to great effect: dynamic classes. These classes can have fields added and removed to them and used like any other field. You can even make your own dynamic classes with the dynamic
keyword. However, all of this fancy functionality comes at a steep performance cost. How steep? Read on to see just how steep.
Recently, I’ve seen a lot of performance-critical code that has made heavy use of field variables. For example, an expensive loop might look like this: for (var i:int = 0; i < this.numObjects; ++i)
. I've recommended to some of the programmers writing such code that they modify it to cache the field variable as a local variable to improve performance. Was I right to recommend this? In today's article I'll examine the read and write times to see if caching field variables locally really improves performance.
Today’s article is a followup to a flawed article I wrote last October. Skyboy’s comment brought this to my attention, so today I’m (hopefully) correcting the problems with an important test: AS3 operators. Read on for the updated test code and results.
Today’s article is the conclusion of the series updating my performance tests in light of the newly-released Flash Player 10.2. If you haven’t read part one or part two, that would be a good place to start. If you already have, read on for the conclusion!
Today’s article follows up on last week’s article that began by running many of the performance tests on this site with the newly-released Flash Player 10.2. Last week I got through half of the performance tests I did in my Flash Player 10.1 followup (see part 1, 2, 3, 4, 5, 6) and today I’ll cover the second half. What faster and what’s slower in Flash Player 10.2? Read on for a ton of performance test updates!
From a performance perspective, lots changed in Flash 10.1 (see part 1, 2, 3, 4, 5, 6). Flash Player 10.2 was officially released last week, so it’s time to update this site’s many performance tests to the new player. This time around I’ll be updating more performance tests per part of this series, so hopefully everything will be updated a lot quicker than last time. Read on for the updates!
Why do I see so many AS3 programmers writing so much redundant code? Are you one of them? Today’s tips may save you a lot of typing. It may even save you a lot of SWF size.