Jump to content
  • Advertisement
Sign in to follow this  

finding performance problems

This topic is 4414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Problem: it's slow! :) hehe - so now . . . what's the best way to go to find out where the problem lies? Is it the fillrate? is it the cpu? is it the vertexshader or pixelshader pipelines on the card? There are so many parts involved and i think it's quite possible that often all of them could handle more but have to wait on one single part which can't do it's job that fast as the other parts do theyr job . . . So how to find the weakest link in the chain? I hope you understand :) Thanks for the help!

Share this post

Link to post
Share on other sites
Try to use a profiler. It will tell you how much time each function consumes and how often it has been called.
If you don't know how to get or use a profiler, try to build some simple kind of profiling yourself, something like this:

startTime = Clock.getCurrentTime();
..call your render engine..
endTime = Clock.getCurrentTime();

renderTime += endTime - startTime;
renderCall += 1;

... do the same thing for input/ai/gamelogic/gui/phyisc.....

At the end of your program log the profiled informations:
- totalTime = programEndTime - programStartTime
- renderTimeInPercent = 100 * renderTime / totalTime
- renderCall (see above)
- averageRenderCallTime = renderTime / renderCall
- ... same for physics/ai/gamelogic....

You can identify performance bottlenecks by:
1. too many calls of a certain function relative to number of total frames
(i.e. if you got 1000 frames while running your program and there are also 1000 calls of your loadTexture function...)
2. if a certain function consumes too much total time, this function could be your bottleneck.
(i.e. updatePhysics used up 96% of the total running time...)

Some tips and pitfalls:
1. If you identify a complex function as your bottleneck, try to break the profiling down to certain parts of this complex function.
2. Don't try to profile small functions which will be called very often, like a dotProduct function, which will be called 1000 of times per frame. In this case hand written profiling often distorts the profiling result.
3. Calling a render api like OpenGL/DirectX is very fast, because this calls are only queued but not immediately executed. This calls will be executed later. You can force the execution of this render calls with API commands like 'glFinish'(OpenGL). Use this API commands to ensure a better measuring of your rendering time.
I.e. if glFinish used up most of the time, the application is most probably GPU bound. In this case try to change the order of your game-pipeline. Instead of using "userInput=>ai=>physics=>render=>swapBuffer" do something like "render=>userInput=>ai=>physics=>swapBuffer". This setup will ensure that your CPU and GPU works concurrently.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!