With structs wrapped up, we can move on to other features of C++. Today we’ll take a look at namespaces. We’ll cover the basics that C# provides, but go so much further and cover a lot of advanced functionality. Read on to learn all about them!
Posts Tagged variable
Many modern strongly-typed languages have introduced a way for you to not have to type a variable’s type. In C#, you can use
var instead of the actual type. In C++, you use
auto. AS3 has a similar feature with it’s “untyped” type:
*. In those other languages,
auto are syntax sugar that the compiler replaces with the actual type. Will the AS3 compiler and/or Flash Player do the same for us? Today’s article finds out if it’s safe to skip the type and just use
describeTypeJSON function is faster than the XML-based
describeType function by default, but we can make it even faster. Today’s article describe just how this is done and achieves a nearly 10x speedup!
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.
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.
I recently perused the AVM2 bytecode overview that Adobe provides and found something strange: they have special instructions for the first few local variables. Getting the first local variables is done by getlocal0, getlocal1, getlocal2, getlocal3, but then a generalized getlocal is used for local variables thereafter. This brought me to think about the performance implications of these specialized instructions. After all, why have them when you already have a generalized one? Read on to see the performance differences and if you can get any speed boost from rearranging your local variables.