[Python-Dev] SET_LINENO and python options

Ken Manheimer klm@digicool.com
Sat, 29 Jul 2000 15:53:17 -0400 (EDT)

On Fri, 28 Jul 2000 Vladimir.Marangozov@inrialpes.fr wrote:

> M.-A. Lemburg wrote:
> > 
> > Separating out LOAD_FAST from the switch shows a nice effect.
> > SET_LINENO is removed by -OO anyway, so there's really no
> > use in optimizing this one.
> Actually, I think that instead of fighting with SET_LINENO
> for the standard setup, it would make sense to change the
> invocation options to something more standard:
> 1) python         - code without SET_LINENO
> 2) python -g      - code for debugging, with SET_LINENO
> 3) python -O      - code without doc-strings.
> The point is that currently there's no optimization of the
> code stream at all, in the sense of classic compiler optimization
> (code block-level optimizations, loop unrolling, etc).
> And SET_LINENO is actually useful only for debugging (with pdb, etc).
> What about this as a sane proposal for SET_LINENO?

I would be firmly -1 on this proposal.  Without a major payoff - say,
double or better performance improvements - i think it's a bad idea to
disable debugging in the common case.  Python already has -o and -oo -
aren't they sufficient?

(Maybe i'm misremembering, but i recall that removing SET_LINENO didn't
yield a whole lot of performance improvement.  Actually, i have the
impression it's been a canonical example of how casual optimizations don't
do what you expect - but i may be off base here.)

I see the ability to debug at whim, even when you didn't expect having to
do so, as being a major win, part of the incremental development process.  
For me, it's a virtue up there with "having the source" in making it
easier to fix my own and other people's mistakes. (The inconvenience of
having to rerun with debugging enabled is magnified greatly when dealing
with connecting to longrunning processes, as i tend to do with zope under
zeo and medusa.  Then i'm really screwed if someone forgot to start with
optional debugging enabled.)

If you can replace SET_LINENO's functionality with something that doesn't
have the same overhead, great!  I have the impression from your recent
comments along these lines that that isn't happening immediately...