home | |||
links |
|
||
developer's mag main page article part 1 part 2 part 3 part 4 part 5 part 6 part 7 part 8 |
2 - Tool #1 - ProfilingCode optimization is often a necessity. Rarely does anyone look at a program and complain that it's too fast, while the opposite is frequently heard. Often optimization is simply a matter of identifying a key routine or two that is consuming the lion's share of the CPU cycles and speeding it up. However, picking the right function is notoriously difficult, and often the 'obvious' choice is wrong. An important tool to assist is the profiler.On the ebm, profiling code involves generating a listing of routines and the time spent executing them. Most importantly, the percentages are listed, allowing you to estimate the benefits of tuning specific code sections. To get the most out of the ebm profiler, consult the SDK documentation, but the basic code profiling is rather simple to do:
The text displayed will be the function time
listing, showing the total time used by each.
With this file, you can accurately know where
to concentrate your efforts. As you tweak
your code and rerun the profiler, you not only will
get a good idea of where you code spends
cycles, but also get familiar with how code
executes in general (for instance, the relative
speeds of different algorithms). And don't
forget that as you reduce the time the slow
section of code takes, other functions will
appear to take more time - it's simply that
they are now a greater proportion of the
execution time, since you're speeding up
the laggard. |
||
Copyright © 2001-2006 ebmDevMag.com - Legal Notice |