I recently received a tip about a thread discussing an interesting problem: how to tell if one Class
object represents a class that subclasses another Class
object. If you had an instance of the class, you could simply use the is
or instanceof
keywords, but that won’t do here. Today’s article shows how to solve this tricky problem.
Posts Tagged performance
Eventually, Flash Player will support Worker Threads to take advantage of multi-core CPUs, but that may be quite a while from now. Today’s article shows you how you can get some concurrency right now by faking threads. Read on for the technique!
Since Flash 8, BitmapData
has offered a wide range of possibilities to improve performance. Many Flash apps, particularly games, choose to simply display a single, huge BitmapData
, render the entire game scene into it and, for the most part, eschew Stage
‘s whole system of DisplayObject
and DisplayObjectContainer
. When you’re doing this or just generally using BitmapData
for more than just raster (e.g. JPEG, PNG) image display, you should know your options for composing a BitmapData
out of other BitmapData
. Today’s article discussing the performance of the two main ways of composing these BitmapData
scenes: BitmapData.draw
and BitmapData.copyPixels
.
One of the advantages of using Dictionary
instead of Object
when mapping key-value pairs is that you can use whatever type of key you want, not just a String
. However, a recent comment points out that the keys are still checked with the loose equality operator (==
) and you can therefore get clashes like 4 == "4"
. For today’s article, I’ve written a TypesafeDictionary
class that allows you to overcome this limitation. Read on for the implementation, performance testing, and more.
The Flash API has a gem of a class in Proxy. You can use it to customize the behavior of the dot (.
), index ([]
), delete
, and in
operators as well as the for-in
and for-each-in
loops. Today’s article answers a recent comment by exploring the performance implications of all this fancy customizing that Proxy
allows.
You, my dear readers, have posed many fine questions and chimed in with many excellent suggestions to my previous articles on typecasting and today I will answer them! (for newcomers to this series, read on for tips showing how to easily speed up your casts by 200x or more)
Logical operators are necessary in every app, so it’s unfortunate that they are so slow in AS3. That’s why I was happy to see a potential alternative in a recent comment by Skyboy. Today’s article shows you how to do logic faster by avoiding logical operators (e.g. &&
) and using their bitwise (e.g. &
) operator counterparts instead.
Sometimes you need to map a key to many values, but AS3 has no built-in data structure for this purpose. Dictionary
and Object
are suitable one-to-one maps, but there’s been no one-to-many support until now. Read on for my own one-to-many class—MultiMap
—as well as performance testing and analysis.
Today’s article is about an unintuitive-yet-simple optimization you can use to hugely increase the speed of reading from Array
, Vector
, Dictionary
, Object
, and dynamic
classes. Need I say more? Read on for this amazing speedup!
Linked lists can be much faster than AS3’s Array
and Vector
classes if you use them under the right circumstances. It’s been over a year and a half since I last visited the topic, but today it’s time to update my LinkedList
class. Read on for the freshly-optimized code and all-new performance testing and analysis!