Last week we started exploring the new features of C# 7.3 in Unity 2018.3 by delving into tuples. This week we’ll continue and look at pattern matching. Read on to see how the many forms of pattern matching are actually implemented by IL2CPP!
Posts Tagged switch
There are a lot of ways to write C# code that has no effect. One common way is to initialize class fields to their default values:
public int Value = 0;. Today we’ll go over five types of useless code and see what effect it has on the actual machine code that the CPU executes. Do IL2CPP and the C++ compiler always do the right thing? Let’s find out!
Today we’ll look at the C++ code that IL2CPP outputs when we use iterator functions (those that
switch statements, and
using blocks. What are you really telling the computer to do when you use these C# features? Read on to find out.
(Website Announcement: check out the new tags page to find articles by topic)
Continuing the series on C# syntax, today we’ll look at the differences an AS3 programmer can expect to encounter when using conditionals (
switch/case/break/goto) and exceptions (
try/catch/finally/throw). We’ll also look at iterators, an all-new category for AS3 programmers that empowers us to both iterate however we want and to write coroutines, a kind of lightweight pseudo-thread.
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.