Archive for March, 2015

IL2CPP Slowdown (Partially Solved)

Tags: ,

The new IL2CPP scripting backend in Unity 4.6.2 and 5.0 is supposed to be much faster than the old Mono backend. I ran some benchmarks, but mostly found slowdowns compared to Mono. Today’s article shows the tests I ran, the results I got, and wonders why the IL2CPP version seems so slow. Perhaps one of you, dear readers, knows the reason why. Update: Part of the reason why has been discovered. Read on for updated results.

Read the rest of this article »

6 Comments

Unity Function Performance

Tags: , , , , ,

Which is the fastest kind of C# function in Unity? There are several to choose from: regular old instance methods, static methods, delegates, and lambdas. Is there any performance reason to choose one over the other? Today’s article answers just these questions by putting each type of function to the test. Read on to see which is fastest and which is slowest!

Read the rest of this article »

4 Comments

Basic LINQ Performance

Tags: , , ,

SQL-style LINQ queries are a concise, readable way of performing various tasks dealing with all kinds of collections. Surely all that convenience comes with a performance cost to it. How bad do you think it is? Today we’ll look at the cost of some basic LINQ queries (Where, Select) versus the equivalent non-LINQ code. We’ll also see how much slower both of them are compared to manually-written, traditional code that does away with all the flexibility. Read on to see the results!

Read the rest of this article »

2 Comments

Redirect Console.Write to Unity’s Console

Tags: , ,

One of the great advantages of programming in Unity is that it uses a (mostly) standard .NET implementation. This means you can find lots of third party code that is written for .NET but not necessarily Unity and still incorporate it into your app. This kind of code typically uses System.Console.Write or System.Console.WriteLine to print to standard output, but Unity doesn’t display it in its Console panel or redirect it to platform-specific logging like Android’s logcat. This article provides a class you can easily integrate into your app to redirect System.Console writes to Unity’s standard Debug logging so it’ll show up like you’d expect.

Read the rest of this article »

16 Comments

Unity Coroutine Performance

Tags: , ,

Unity’s coroutine support allows you to easily create pseudo-threads and write synchronous-looking code that doesn’t block the rest of the app. They can be very handy for a variety of tasks. Before using them, we should understand the performance cost. Today’s article takes a look at the cost of starting a coroutine as well as the cost of running it. Just how expensive are they? Read on to find out!

Read the rest of this article »

11 Comments