[Courses] C Programming For Absolute Beginners, Lesson 4: Getting Looped

Mel Chua mel at melchua.com
Tue Mar 6 22:06:05 UTC 2012


> Note that this is an inefficient way to output this text. Less function
> calls are generally more efficient than more function calls, because the
> processor has to make larger jumps in the code, move parameters, and
> such like. I/O calls are especially slow.

Out of curiosity, what (simple) tools are there to give rough gauges on 
how efficient your code is? Is there a gcc flag that will output some 
"efficiency" metric (and what efficiency metrics exist)?

The only thing I can come up with is "look at the timestamp when you 
start the compiler, and when the compilation finishes," and the same 
thing for when you run the actual program, but that's... a terrible, 
processor-dependent, other-processes-running-at-this-time-dependent, 
low-resolution data output way. There's got to be a better one.

--Mel


More information about the Courses mailing list