[Python-Dev] bdb.py trace C implementation?

Guido van Rossum guido at python.org
Thu Apr 2 00:48:59 CEST 2009

On Wed, Apr 1, 2009 at 3:25 PM, Benjamin Peterson <benjamin at python.org> wrote:
> 2009/4/1 David Christian <david.christian at gmail.com>:
>> Hi all,
>> I've recently written a C version of the trace function used in
>> figleaf (the coverage tool written by Titus).  After a few rewrites to
>> add in caching, etc, it gives users a significant speedup.  One person
>> stated that switching to the C version caused coverage to decrease
>> from a 442% slowdown to only a 56% slowdown.
>> You can see my C implementation at:
>>  http://github.com/ctb/figleaf/blob/e077155956c288b68704b09889ebcd675ba02240/figleaf/_coverage.c
>> (Specific comments about the implementation welcome off-list).
>> I'd like to attempt something similar for bdb.py (only for the trace
>> function).  A naive C trace function which duplicated the current
>> python function should speed up bdb significantly.  I would initially
>> write the smallest part of the C implementation that I could.
>> Basically the tracing function would call back out to python at any
>> point where a line requires action.
>> I'd be willing to maintain the C implementation.  I would be willing
>> to write those tests that are possible as well.
>> Is this something that would be likely to be accepted?
> Generally debugging doesn't require good performance, so this is
> definitely low priority. However, if you can contribute it, I don't
> have a problem with it.

Tracing has other uses besides debugging though. In particular,
coverage, which usually wants per-line data. Also, sometimes if you
set a breakpoint in a function it turns on tracing for the entire
function. This can sometimes be annoyingly slow. So, personally, I am
more positive than that, and hope it will make it in.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list