We’ve seen that if-else
trees are way faster than Object
, Dictionary
, and even switch
at key-value mapping, but how do they stack up against Array
and Vector
? Today’s article puts them to the test and uncovers some unexpected results.
Posts Tagged if-else tree
If-else trees have some of the best performance of any conditional code, including if-else
ladders, the ternary (? :
) operator, and the switch
statement. But how do they stack up against the O(1) lookups that Object
and Dictionary
offer us AS3 programmers? Today’s article finds out!
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?