When I first discovered LINQ, it completely changed the way I program. I'd already been coding for a very long time (mostly using LAMP - Linux, Apache, MySQL, and PHP) so I was familiar with SQL queries, but the idea of being able to query data directly in C# was entirely new to me.

After a while, it became the new way of doing things for me - so much so, that I ended up finding a plugin so that my dev team could even use LINQ in PHP.

That said, there are, as always, arguments for and against LINQ - as with any other tool, it's important to know when to use it, and when not to use it.

Read More First article

In game programming, it is very common to perform a lot of complicated calculations over and over, often many times per frame. There's nothing inherently wrong with that, but sometimes some of those calculations only need to be performed once - e.g. if, given the same parameters, you'd get exactly the same results. In cases like that, you may be served well by caching the result of the calculations rather than performing them again.

With that said, there's a lot more to caching than simply storing the results of performance-intensive calculations - it'd be a mistake (and one I've made frequently) simply to cache everything that looks like it might benefit from being cached.

Read More First article

Often, with C# code (or any language really), it's easy to get away with code that isn't exactly optimized for performance - often without even noticing just how badly it can perform. When developing code to work in a game engine such as Unity, this is especially true. In earlier versions of Unity, for example, the foreach loop is inefficient and leaks garbage, which the garbage collector will then have to spend time cleaning up.

The impact of something like this is relatively minor on the overall performance of your application - but what if the code containing the loop executes multiple times each frame? The unnecessary nanoseconds of execution time consumed by the loop start to add up, especially on devices with less processing power, such as cellphones and tablets.

As such, it's important to learn:

  • When to start optimizing
  • Types of optimization issues
  • How to track down and identify optimization issues
  • How to correct them

Read More First article