Is there a way to profile underlying C++ code?
chris.cavalaria at free.fr
Thu Jan 26 18:20:44 CET 2006
Bo Peng a écrit :
> 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.
There might be one possibility for you. If the order of the random
positions you get has no meaning for the final result, you could start
by generating all those numbers, sort the list and then do the lookups.
More information about the Python-list