Posts Tagged performance

Stage3D KIL Command

Tags: ,

Flash Player 11’s Stage3D gives you only a few opcodes to do conditional logic and none of them are as effective as the good old if in AS3. The most unique one of all is the KIL opcode that discards the pixel being drawn. How does it work? How does it perform? Today we’ll find out!

Read the rest of this article »

11 Comments

Speed Up Alpha Textures With Stage3D By 4x

Tags: , , , ,

Now that we know how to use textures with an alpha channel in rendering Stage3D scenes, let’s see if we can cut the performance cost so we can use them more often. Today’s article will show some tricks to optimize your rendering loop.

Read the rest of this article »

5 Comments

Using Alpha Textures With Stage3D

Tags: , , , ,

Stage3D makes a lot of common tasks more complicated. One such task is using a texture/image that has alpha on it. With classic 2D Flash, this is done automatically for us. With Stage3D, we must resort to some obscure tricks. Today I’ll show you those tricks so you can use alpha textures in your Stage3D-accelerated Flash app.

Read the rest of this article »

2 Comments

Sorted Array

Tags: , , ,

AS3 gives you arrays and a way to sort them, but no easy way to keep them sorted as you add elements to them. Today’s article discusses an easy way to do just that: build a sorted array and keep it sorted. As a bonus, the array provides very fast searching for the elements it contains.

Read the rest of this article »

19 Comments

Better Ways To Check Class Inheritance

Tags: , , ,

If you want to check if one class inherits another without actually having instances of those classes, you may have read my article on Checking Class Inheritance. However, as the many comments quickly pointed out, the methods of checking this may have some flaws. There were also additional methods posted in the comments that should be added and tested. Today I’m adding them, testing them, and checking all of their validity to find the ultimate approach to check class inheritance.

Read the rest of this article »

2 Comments

Function Performance Update

Tags: , , , , , , , ,

Above all others, there is one article I refer back to most: 2009’s Function Performance. It was updated for Flash Player 10.1 and 10.2, but not 10.3, 11.0, 11.1, or 11.2. Today I’m updating this article for Flash Player 11.2, adding some missing function types, and including a set of graphs to make for the ultimate function performance reference.

Read the rest of this article »

4 Comments

Faster Stage3D Rendering With View Frustum Culling

Tags: , , ,

While my three part series on draw calls in Stage3D urged you to reduce them as low as possible, it didn’t give you much in the way of techniques for avoiding them. Sure, it had some good ideas for combining 2D sprite draws into a single draw, but how about 3D? Today’s article tackles the concept of “view frustum culling” to provide an automatic speedup to virtually any 3D app utilizing Stage3D.

Read the rest of this article »

24 Comments

Double the Performance of Stage3D Apps

Tags: , , , , , ,

To draw with Flash Player 11’s Stage3D API, you must set up the state of various GPU resources before finally calling drawTriangles. Inevitably, you’ll end up calling drawTriangles multiple times during a single frame to draw your characters, terrain, sky, and so forth. In between these calls you will change the GPU’s state by calling Context3D‘s set* functions. This article will show you which of these functions can literally cut your app’s performance in half.

Read the rest of this article »

15 Comments

Building Strings

Tags: , , , , ,

When a recent comment asked about string concatenation performance, I realized that there are a lot of ways to build strings in AS3 and I hadn’t tested any of them. Leaving aside the sillier ones like the XML class or joining Array objects, we have two serious contenders: the lowly + operator (i.e. str + str) and the ByteArray class. Which will triumph as the ultimate way to build strings quickly?

Read the rest of this article »

18 Comments

Vector vs. ByteArray

Tags: , , , , , ,

Which is the fastest way to store data: Vector or ByteArray? Given that you can upload both types to Stage3D in Flash Player 11, this question has never been more relevant. So which should you use to maximize your app’s speed? Read on for the performance testing.

Read the rest of this article »

14 Comments