Is there a way to profile underlying C++ code?

Bo Peng bpeng at rice.edu
Wed Jan 25 21:17:21 CET 2006


Travis E. Oliphant wrote:

> On Linux you can use oprofile (which is pretty nice and easy to use --- 
> no recompiling.  Just start the profiler, run your code, and stop the 
> profiler).

Thank you very much for the tip. This is a great tool.

The source of the problem has been found: cache misses. Briefly, I have 
a long array and I need to choose numbers from it randomly. When the 
array is short, the performance is good. When the array is big, picking 
a number will cause a cache miss almost all the time. This results in 
almost doubled execution time.

Problem found, but I am out of idea how to fix it since the nature of my 
algorithm is working randomly on large arrays.

Cheers,
Bo



More information about the Python-list mailing list