Saturday, March 17, 2007

ARE 'FOREACH' LOOPS THAT BAD FOR YOUR GAME?

Lately, many developers have been asking about any performance issues that the use of "Foreach" loops could bring to their XNA-based games, both in the PC and XBox360 platforms.

As a result of all those questions, Cornflower Blue decided to carry out its own research with the help of the "CLR Profiler" tool.

From Eli's post: "... I wanted to get the whole story. Plus, this was an ideal reason to learn to use the Windows and Xbox 360 CLR profiling tools, which I've put off doing for some time. So, I figured I'd do just that: do a foreach loop over a bunch of collections, use the profilers to see if I'm making garbage, and hopefully we'd all learn something in the process. ...".

It's a nice read, but most important, the results Eli's obtained are quite interesting, so go ahead, pay a visit to "Foreach, Garbage, and the CLR Profiler" and read on.

Enjoy!