Skip to main content
gamedev.net
🔒 Locked

Efficiency Analysis

Started by TheUmpteenth Jun 21, 2007 at 6:07 AM 5 replies 700+ views
Original Post
TheUmpteenth
TheUmpteenth
I'm using VS2005, and although I've been programming for quite a long time, I've never actually known how to analise the efficiency (in terms of memory/cpu time/ anything else) of my code. Are there any tools, or is there a specific way you guys would reccommend? I'd also like to find out if there's any way to search for memory leaks. Thanks.
TheUmpteenth
TheUmpteenth
Thanks.

Can I use this without using MFC? don't #define stdafx anywhere, cos I ain't got one.

also, lots of classes, so lots of files, and not a few #include <>s (mainly d3dx9.h or windows.h) so will this make a huge difference?

THX
Ravuya
Ravuya
For checking performance, you want to get a profiler. I think popular ones on Windows are Intel VTune and AMD CodeAnalyst, though I'm sure there's others. To make sure you aren't leaking memory or running over the bounds of arrays, you can adopt something like mmgr or efence, though those don't always count small violations.

On Mac OS X, we generally use Shark, which is a profiler that makes suggestions regarding vectorization and parallelism as well as providing multiple categories of profiling data. With the new release of Xcode (in October), they're going to add a bunch of other profiling "instruments" to Xray and open up the ability to write your own (I plan on writing a plugin to track AI state to detect "wibbling").
TheUmpteenth
TheUmpteenth
Thanks to you both. Hopefully this will improve my code a bit :)
gdunbar
gdunbar
Also, if you don't feel like learning how to use a profiler, just doing simple timing is often enough for decent perf analysis. For instance, measure the time when your render call starts, measure it again when the call ends, and dump the result to a trace file. If it's too slow, do the same for the sub-calls. Continue until you find out what you need to optimize.

This isn't recommended for large projects where you aren't familiar with much of the code, but it can be crudely effective in many cases.

Geoff

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.