Tuesday, March 10, 2009

Hello, I fixed a lot of issues I had with the console I didn't know about.

I'm now using the same effect (an instance of XNA's BasicEffect) for every component.

Lines are now traceable. That is, each line you draw have a name, then when you draw a line with the same name, the previous line gets moved.

Some of you might had problems with the ShowLine and ShowMark methods, fixed.

I have created a new command parser in order to add scalability. You can now for example use Game1.console.Execute("trace Player1.position", position);and would be the same as using Game1.console.Show("Player1.position", position);. This is because later I will add the feature to trace values in runtime, something that will decrease debugging time for your games.

Monday, March 09, 2009

LINQ Benchmark fixed.I posted about the benchmark in the Creators Club forums and they explained me why these results were incorrect. I measured it wrong.The thing is that on the LINQ test I wasn't actually running the query. To run it, I must at least iterate over the result, this is because the defered execution of the IEnumerable implementation, and the return yield it runs.

So I rewrote it, and the results came out more predictable, here you have them.

I also increased the valueCount to a hundred million values. And there you have it, even though LINQ version is more elegant, it took almost twice the time, so for time critical operation I would prefer avoiding it.

Thursday, March 05, 2009

LINQ Benchmark

For those of you that doesn't know LINQ yet, it's a new technology from c# 3.0 that lets you run queries independently from your database, even on c# objects (like arrays, List, LinkedList, etc) with a SQL-like statement .

Yesterday I was wondering how fast LINQ could run some queries compared to more traditional methods. I'm not talking about LINQ to SQL on an external database, but running a query on some IEnumerable object instead. So I created a small benchmark. I'm not sure if it is correct because there is some stuff that I might be timing erroneously, so please tell me if I should be considering things like JIT time, GC, or any other housekeeping.