Members - Reputation: 777
Posted 07 June 2012 - 06:25 PM
The most likely reason for my poor performance is my heavy reliance on lots and lots of .Net classes, especially dictionaries and lists, to manage everything. I usually end up creating a ton every step, and that's a no-go. So when I'm writing my new engine, how can I stop myself from making too many unnecessary objects? If it really comes down to trying to thwart the garbage collector, I'm up for switching over to C++ and doing manual memory management.
Moderators - Reputation: 14304
Posted 07 June 2012 - 06:32 PM
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
Members - Reputation: 643
Posted 07 June 2012 - 08:28 PM
ApochPiQ mentioned pushing data through the pipe as an issue. That could be something, if you've got a massive terrain, maybe it's too massive, maybe you should do some cpu culling or use the pipelines culling facilites.
It's hard to talk about your particular issues, because you haven't given us much information.
I have a slimDXFramework libary, and a UserInterface library both from which I inherit all sorts of classes as I am constantly striving to build a general purpose code base from which I can inherit all my functionality. Perhaps of relevance to what you have said, my UI library has lists for controls and containers, my ResourceServer uses a dictionary but then it is only ever fetched from when resources are built into UI / game classes. Those things don't concern me as far as performance is concerned. What concerns me is size and complexity of my pixel shaders, whether my resources can be kept in graphics mem to reduce transfer costs, geometry culling & spacial partitioning. When you start looking at these issues (and others) you'll be making savings of 20 to 500% in ur rendertimes so it kinda makes the 5% overhead of memory management look kinda inconsiquential. You say are trying to thwart the garbage collector ? I hardly ever think about the garbage collector, except to casually think on object lifetime. After all, most of your objects should remain unchanged from frame to frame. So why would you be recreating objects all the time ? For advise on how we can help you prevent this practice, example code would really help.
If you haven't done it already, I absolutetly recommend that you build yourself a clock class and do a sweep of your program to time function calls (or use some kinda performance tool). This will pinpoint where your performance issues are and we can start talking about specifics.
Crossbones+ - Reputation: 3737
Posted 07 June 2012 - 09:40 PM
(That's assuming you aren't doing anything crazy like copying a List<T> with 400,000 items in it on each frame...)
Educated guesses are still just guesses! Get a profiler and profile your app! A profiler will show you hard facts.
- There are free profilers for .Net that are pretty painless to use (CLR Profiler).
- There are free profilers for analyzing GPU apps (Intel Graphics Performance Analyzer).
Edited by Nypyren, 07 June 2012 - 09:46 PM.