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

David Christian david.christian at gmail.com
Thu Apr 2 01:07:32 CEST 2009

On Wed, Apr 1, 2009 at 6:53 PM, Benjamin Peterson <benjamin at python.org> wrote:
> 2009/4/1 Guido van Rossum <guido at python.org>:
>> Tracing has other uses besides debugging though.
> The OP said he wished to implement a C trace function for bdb.
> Wouldn't that make it only applicable to debugging?
> Benjamin
I was suggesting a speedup for debugging.  However, I could certainly
also contribute my figleaf work that I referenced earlier, with a few
tweaks, as a tracing replacement for the tracing function in trace.py.

My concern with moving the coverage tracing code in particular to the
standard library is that it tries to extract the maximum speed by
being clever*, and certainly has not been out in the wild for long
enough.  I would write something much more conservative as a starting
point for bdb.py.  I expect that any C implementation that was
thinking about performance at all would be much better than the status

* figleaf checks a regular expression to determine whether or not we
wish to trace a particular file.  If the file is not being traced, I
switch to the profiler instead of the line tracer, which means that
the trace function only gets called twice per function instead of once
per line.  This can give a large speedup when you are skipping the
entire standard library, at some measurable cost per function call,
and a cost in code complexity.

David Christian
Senior Software Engineer
rPath, Inc

More information about the Python-Dev mailing list