Let’s continue the series with another nuts-and-bolts topic: control flow. The Venn diagram is largely overlap here, but both C# and C++ have their own unique features and some of the features in common have important differences between the two languages. Read on for the nitty-gritty!
Posts Tagged for
There are many permutations of loops we can write, but what do they compile to? We should know the consequences of using an array versus a
Length, and other factors. So today’s article dives into the C++ code that IL2CPP outputs when we write these various types of loops to examine the differences. We’ll even go further and look at the ARM assembly that the C++ compiles to and really find out how much overhead our choices are costing us.
Today’s article takes a break from the iterator series to investigate an interesting anomaly with the
List.ForEach function: it’s surprisingly fast! So fast that it’s actually competitive with regular old
while functions. How can it be so fast when it has to call a delegate that you pass it for every single loop iteration? Read on for to find out!
foreach loops are really convenient, but are
for loops faster? It’s a simple question, but one that has really wide implications in almost any codebase. Today’s article tests them out to see which is faster for looping over arrays and
Lists. Read on to see which is quicker!
do-while loop is slower than the
while loops… at least in Flash. Why? Today’s article digs into the bytecode the compiler generates for a variety of these loops to find out why.
AS3 has three kinds of loops—
for-each—but which is fastest? I attempted to answer that question about three years ago, but the article is in dire need of a followup as many version of Flash Player have been released since then and the question is core to our everyday lives as AS3 programmers. So which type of loop is fastest in 2012?
AS3 has two integer types:
uint. In my experience, most AS3 programmers just use
int everywhere and ignore
uint. This is usually acceptable as the need for unsigned integers is rare compared to their signed counterparts. However, there are significant performance differences between the two. Read on for the impact of
uint on your loops. The original version of this article’s performance test contained a small-but-critical error that led to a lot of incorrect analysis and results. This version of the article has been corrected.
I wrote an article last November titled For Vs. While that needs a bit of updating an expanding today. While I updated the performance figures in my series on Flash 10.1 performance, I continue to get questions in the comments section of the original article that explore new areas. So today we’ll look at the ubiquitous
while loops a little more.