[Tutor] performance loss -- profiling

Alan Gauld alan.gauld at btinternet.com
Tue May 19 00:16:13 CEST 2009

"spir" <denis.spir at free.fr> wrote

> Also, it's the first time I really have to cope with machine-time; 
> so I'm totally new to technics like using a profiler. 
> Any hints on the topics heartfully welcome :-)

Profilers are a bit like debuggers. Very useful when needed 
but usually a point of last resort.

First, what OS are you on?
Linux/Unix has a host of tools that can help pinpoint the causes, 
such as whether there is excess disk I/O or memory use or 
if its another process stealing CPU resource.

Windows can do these things too but the tools and techniques 
are totally different - and require a bit more experience to 
interpret IMHO.

But my first bet would be to check the CPU and memory usage 
to see if either is high. Also if it uses the network, either to go to 
a server(databases? files?) then check network traffic.

If you can spot the nature of the hot spot you can often guess 
where in the code the issues are likely to be.

Other common causes to consider are:
- Locking of files? ie concurrent access issues?
- Queuing for shared resources? Have you started running multiple 
- data base query time - have you increased the volume of 
  data being searched? Did you index the key columns?
- Directory path traversal - have you moved the location of 
any key files? Either the executables/scriopts or the data?

Just some ideas before you resort to profiling.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list