SET_LINENO

Michael Hudson mwh at python.net
Fri Sep 27 06:18:14 EDT 2002


I'm the one responsible for SET_LINENO going away in 2.3, so here's
my take...

Bruce Dawson <bruce_deletethis_dawson at cygnus-software.com> writes:

> Executive summary: Has the SET_LINENO removal been tested with the HAP
> debugger, 

No.  I'd never heard of it for one thing!

> and wouldn't a breakpoint instruction give much larger
> benefits?

I fail to see how.

> As a partial author of the HAP Python Debugger (available on source
> forge) I read about the imminent removal of SET_LINENO with some
> worry. It *sounds* like it has been done in such way to not cause
> debugger problems, but I'm curious if anyone has tested HAP with 2.3.

I tried really hard to make it transparent to debuggers.  There are a
few very small differences, but unless you're actually scanning for
SET_LINENO instructions they shouldn't bite.  I'd invite you to test,
of course.

> Also, it sounds like the reason for removing SET_LINENO was to improve
> the performance of Python scripts. However one of the posts on this
> topic (can't find it now) suggested that the hoped for improvements
> had not actually materialized.

It speeds programs run without -O.  On Windows, programs run with -O
got somewhat slower after this patch (on Linux it made essentially no
difference, maybe a very slight speedup).  See Tim's post.

> It seems to me (from the sidelines/peanut gallery/wherever) that the
> biggest performance problems in the SET_LINENO area are when
> debugging, not when running free, and that therefore this optimization
> is targeting the lesser problem.

You've got my motivation entirely backwards there.

> The need to check for breakpoints at each line has always made Python
> debugging performance poor at best. Technically the performance under
> the debugger doesn't matter, and yet sometimes it does. Having just
> helped complete a Python based sports game for PC, where real-time
> performance was critical, I can say that the slowdown in HAP was
> definitely annoying.

You're faced with a hard problem.  Good luck :)

> So, wouldn't a break-point opcode be a more substantial improvement
> than removing SET_LINENO? Just bringing up that old topic again to see
> if it gets any more traction :-)

How would a breakpoint opcode differ from what SET_LINENO was?

> P.S. For reference I include the canonical? link to the SET_LINENO
> discussion.
> 
> http://mail.python.org/pipermail/python-dev/2000-July/007652.html

Note that what I did bears little resemblance to the scheme sketched
in that post.  I hack stuff out of co_lnotab.

> P.P.S. A breakpoint instruction would also be a boon for asserts - I'd
> love to be able to stop on the assert when running under a debugger,
> to see what is wrong before the stack frame unwinds.

Well, you break on the exception, don't you?

Cheers,
M.

-- 
  The "of course, while I have no problem with this at all, it's
  surely too much for a lesser being" flavor of argument always
  rings hollow to me.                       -- Tim Peters, 29 Apr 1998



More information about the Python-list mailing list