Performance issues

Oct 26, 2011 at 2:18 PM

I've done a bit more performance testing using the profiling built into VS2010. As I said previously, GPU load is low and CPU cycles are not a problem in normal drawing (but cause major difficulties with SpriteBatch()). However, it's quite noticeable that my samples with lots of objects hit on the machine much harder than the CPU load would suggest (general lack of responsiveness, CPU fan cuts in, etc).

The problem appears to be in memory load. The drawing code generates large quantities of memory allocations and this affects the entire game.

As far as I can tell there are two areas to worry about. One is the allocation of Vertex memory, and the other is the use of enumerators/Linq code. I don't know the code well enough to know how best to test it, but these are definitely the hotspots on my limited testing. In a run of 20 seconds doing nothing but draw, there were about 1.4 million allocations, total about 95 MB. Under Scene.Draw() is 1.3 million of the allocations but only 40MB.

The total memory usage is not a worry, but 70,000 allocations per second is enough to stress the system. You might want to take a look when you have time.

Oct 27, 2011 at 5:09 AM
I'm also aware of that. I think it's mainly caused by enumerators, linq, yields and lamda expressions. I'll try to fix some hot spot. Thanks for pointing out.
Nov 3, 2011 at 11:35 AM

I see you've done some work on this. I'll check out and get back to you.