Stephen Calender Programming Blog


Sprite versus MovieClip

Tags: Optimization.

SpriteVsMCGraph

For years I have heard horror stories about the bad performance of Flash’s MovieClip class, so much so that I have aggressively replaced as many objects as I can with Sprites. Obviously MoiveClip objects use a bit more memory, but how much more processing time do they take compared to Sprites? When exactly do they become expensive? Does it matter how you have your display list organized (according to Adobe, shallower is better; however, we do not have a cost comparison)? Surprising answers and discoveries are abound! Full Article

Comments (0)

Faster Rectangle Class

Tags: ActionScript 3.0, Optimization.

“An underlying theme I have discovered with Flash is that you are often better off writing your own code than trusting Adobe’s classes and functions, data structures are no exception.” – taken from my flash particle system article

After the launch and first few patches of Lego Universe, work at NetDevil has calmed down enough that I have the time and energy to explore private projects again. The current project I am working on is large and it is still in the design, test, research phase since it needs to very optimized. I saw that I was going to be doing quite a few rectangle intersects and intersection operations (the function that determines whether two rectangles overlap and the function that returns the overlapping rectangle respectively) so I took a look at the speed of Flash’s native rectangle class. I clocked Flash’s intersects function speed at over 150 simple operations (adds, multiplies, and accessing class members all count as one simple operation from my benchmarking series). I thought to myself “I can do better than that” – I was right, and I managed to write a faster intersection function too (free code).

Full Article

Comments (5)

Flash Particle System

Tags: ActionScript 3.0, Optimization.




A particle system is the quintessential video game effect used for clouds, fog, mist, smoke, rain, snow, fire, explosions, dust, debris, sparks, magic, spray, splatter, and other phenomenon. They have been around since the early 1980s, William T. Reeves is the inventor, but its most notable debut to the public was when the group that eventually became Pixar (employed by Lucasfilm Ltd. at the time) used a particle system in Star Trek: The Wrath of Khan (1982) for the ‘genesis effect’. It is mystifying that such a classic creative tool is missing from Flash.

Full Article

Comments (6)

Benchmarking: Results

Tags: ActionScript 3.0, Optimization.

Sweet Sweet Benchmarking A speed comparison across all trials. If you would like to view the full results they are available in cvs, htm, and xls formats.

Full Article

Comments (4)

Benchmarking: Graphics

Tags: ActionScript 3.0, Optimization.

These trials are concerned with rendering speed as well as common manipulations and methods of art assets. Full Article

Comments (1)

Benchmarking: Data Structure Speed

Tags: ActionScript 3.0, Optimization.

Data structure trials focus on comparing speeds of variables, object types, classes, and the speed at which you can access and modify your data. Full Article

Comments (2)

Benchmarking: Operation Speed

Tags: ActionScript 3.0, Optimization.

The fundamental speed hierarchy, bit shifting < addition < multiplication < division, is true for all languages. However, it is still important to know the speed difference between operations. Furthermore, the basic operations have many different flavors in which they can be written. All of these trials compare basic operation speed, alternative syntax, and mathematical substitutions. Full Article

Comments (0)

Benchmarking: Methodology

Tags: ActionScript 3.0, Optimization.

I know most of the die-hard critics our there are going to want to see my code, and that is perfectly acceptable. As I have already stated myself, many of the people trying to figure out this black box do a poor job. Just do not expect all of my code to be made public, if you want to grab the source it is available here. Full Article

Comments (2)

Benchmarking: Introduction

Tags: ActionScript 3.0, Optimization.

Not everyone needs to worry about writing the most optimized code. In fact, if you are programming Flash websites or small projects you probably should not be concerned with it – some would even argue that it would be inefficient since more optimized code takes more care to write. However, there are those projects that are large or complex enough that it is essential, and many times, we have a very vague idea of where to draw the line between simple and complex. Full Article

Comments (5)