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
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 quite a
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 are
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
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():
... return 2+3
[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
isn't: