[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-cpp-sig
Subject:    [C++-sig] Re: profiling code
From:       ndbecker2 () verizon ! net (Neal D !  Becker)
Date:       2004-09-16 18:53:53
Message-ID: cicges$ofn$1 () sea ! gmane ! org
[Download RAW message or body]

Vladimir Prus wrote:

> Hi Neal,
> 
>> I realize this isn't exactly specific to boost-python.  I want to profile
>> my
>> boost-python code.  I'm using Linux.
>> 
>> AFAICT, I would need to use a version of python build with -pg. 
>> Hopefully
>> this would allow profiling dynamically loaded modules?  (I haven't tried
>> it recently).
>> 
>> Is there any way to profile my modules without building a special python?
> 
> Sure, you can you the valgrind "skin" called "calltree". It produces a
> profile file which can be then visualied using the "kcachegrind" tool.
> Advantages: no need to recompile anything. You also get better precision
> because the binary is not alterted by the profiling code.
> Disadvantages: since valgrind essentially emulates processor, the program
> will run 10 times slower.
> 

2 points:

1) Thanks! callgrind + kcachegrind are fantastic tools.

2) I was able to speed up my code by 4X.  Turns out, problem was my use of
index operator [] on iterators instead of ++, etc.

David Abrahams told me this more than once.  Moral:
Listen to Master Abrahams!


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic