Posts Tagged for

C++ For C# Developers: Part 47 – Containers Library Wrapup

Tags: , , ,

We’ve covered all the individual container types, so let’s take a step back and look at the containers library as a whole. A lot of features, like support for range-based for loops and allocator customization, are supported in all container types. Today we’ll take a look at the commonalities between the containers and see what ties them together into a cohesive library.

Read the rest of this article »

2 Comments

C++ For C# Developers: Part 6 – Control Flow

Tags: , , , , , , , , ,

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!

Read the rest of this article »

6 Comments

Loops in IL2CPP

Tags: , , , , , , ,

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 List<T>, for versus foreach, caching 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.

Read the rest of this article »

3 Comments

Loop Performance: Part 4

Tags: , , , , ,

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 for, foreach, and 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!

Read the rest of this article »

2 Comments

Loop Performance: For vs. Foreach vs. While

Tags: , , ,

Today’s article expands on the previous loop test article to find out which kind of loop is truly fastest. Read on to find out!

Read the rest of this article »

4 Comments

For vs. Foreach

Tags: , , , , ,

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!

Read the rest of this article »

12 Comments

Bytecode Analysis: Why do-while Is so Slow

Tags: , , ,

The do-while loop is slower than the for and 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.

Read the rest of this article »

11 Comments

Loop Speed Redux

Tags: , , , , , , , , , ,

AS3 has three kinds of loops—for, for-in, and 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?

Read the rest of this article »

15 Comments

Loops With int and uint

Tags: , , , , , , , , ,

AS3 has two integer types: int and 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.

Read the rest of this article »

8 Comments

For Vs. While Revisited

Tags: , , ,

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 for and while loops a little more.

Read the rest of this article »

8 Comments