Re: [Python-Dev] python optimization

2005-09-16 Thread Nick Coghlan
Neal Becker wrote: > One possible way to improve the situation is, that if we really believe > python cannot easily support such optimizations because the code is too > "dynamic", is to allow manual annotation of functions. For example, gcc > has allowed such annotations using __attribute__ for qu

Re: [Python-Dev] python optimization

2005-09-16 Thread Neal Becker
One possible way to improve the situation is, that if we really believe python cannot easily support such optimizations because the code is too "dynamic", is to allow manual annotation of functions. For example, gcc has allowed such annotations using __attribute__ for quite a while. This would al

Re: [Python-Dev] python optimization

2005-09-15 Thread Raymond Hettinger
[Neal Becker] > >>I don't know to what extent these kind of optimizations are available to > >>cpython. For example, are constant calculations removed from loops? [Brett Cannon] > > If you mean ``2+3``, then yes. [Greg Ewing] > Actually, no. Constant folding *could* be done, but it currently i

Re: [Python-Dev] python optimization

2005-09-15 Thread Greg Ewing
Brett Cannon wrote: >>I don't know to what extent these kind of optimizations are available to >>cpython. For example, are constant calculations removed from loops? > > If you mean ``2+3``, then yes. Actually, no. Constant folding *could* be done, but it currently isn't: >>> def f(): ... re

Re: [Python-Dev] python optimization

2005-09-15 Thread Brett Cannon
On 9/15/05, Neal Becker <[EMAIL PROTECTED]> wrote: > I use cpython. I'm accustomed (from c++/gcc) to a style of coding that is > highly readable, making the assumption that the compiler will do good > things to optimize the code despite the style in which it's written. For > example, I assume con

Re: [Python-Dev] python optimization

2005-09-15 Thread Chris Cioffi
Hi Neal,   I don't believe that cpython currently does any of the optimizations you refer to below.  That said, it is very reasonable to adopt "a style of coding that is highly readable, making the assumption that the compiler will do good things" when coding in Python.  Python is one of the most h

Re: [Python-Dev] python optimization

2005-09-15 Thread Aahz
On Thu, Sep 15, 2005, Neal Becker wrote: > > I use cpython. I'm accustomed (from c++/gcc) to a style of coding > that is highly readable, making the assumption that the compiler will > do good things to optimize the code despite the style in which it's > written. For example, I assume constants a

[Python-Dev] python optimization

2005-09-15 Thread Neal Becker
I use cpython. I'm accustomed (from c++/gcc) to a style of coding that is highly readable, making the assumption that the compiler will do good things to optimize the code despite the style in which it's written. For example, I assume constants are removed from loops. In general, an entity is de