Efficiency testing?

Is there a way to test two separate solutions for one problem to see which is more efficient (not in terms of RAM usage, but in terms of CPU usage)? Any tools I should become familiar with?
Any tools I should become familiar with?


Not that I know of.

One thing you could do is keep a global variable that gets increased every time a certain function is called. The more variables counting different things, the better a look at your program you can have.

Some things, like a switch vs if/else might not be as apparent with this method. Every time the program needs to access a variable, this takes time.

It would make the difference between a linear vs binary search apparent, and perhaps at least help get the large chunks of fat off.
If you use visual studio you can use the profiler to do a performance test.
I'll try out the profiler in visual studio. I use visual studio for editing, but I use the gcc compiler. The syntax for visual studio is just far better than Notepad++ and Crimson Editor (in my experience) and far easier to read.

I'll try that out LowestOne but I'm not sure it'll be too much good. Still, won't hurt to try.

Thanks.
Could just monitor the thread relating to your program (assuming its monothreaded) and your OS should be able to tell you how much CPU time it's taking. Or you could just write a relatively simple program to monitor the thread for you and write some data to a file.
Topic archived. No new replies allowed.