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 if-else
Surprisingly, some interesting things have been happening with conditionals like
if-else in AS3. First, a brand new AS3 compiler—ASC 2.0—has been released with the promise that it’ll generate more efficient bytecode. Second, some readers have pointed out the existence of a new (to me) technique: the “if-else tree”. Today’s article takes a look at just what that is and tests it against the classic options:
if-else, the ternary (
? :) operator, and the
switch statement. Which will be fastest?
Today I’m revisiting an article I wrote last August about conditionals:
if-else chains, ternary (
? :) operators, and
switch statements. In that article I showed that
if-else chains are about as fast as ternary operators and that both of them are 10-15% faster than
switch statements. Today we’ll take a look at how those conditionals scale beyond just the few cases in the last article.
Now that the Flash Player 10.1 testing is through I can return to a comment asking about the performance difference between
if-else chains and the ternary (
? :) operator. Further, I’ll discuss
switch statements to see if there is any difference in performance for these commonly-used methods of flow control.