Simple question about how the optimizer works

Andrew Dalke dalke at dalkescientific.com
Fri May 10 03:46:45 EDT 2002


jb wrote:
> And what about pure calculations? Let for example a,b and c be long
> integers. Then what about
>
> x1=a*b*c+1-3
> y1=sqrt(a*b*c+7)
 ...
> Can such calculations be optimized?

Sure, because you said "can."  But for dynamically typed languages
like Python that gets hard to do.  When this discussion has come up
before phrases like "whole program analysis" and "just in time" and
"the language Self" are also mentioned.

Is it easy?  No.  Is it easy to get right?  Given the number of
errors I've seen in C compilers, esp. in optimization, the answer
is still no.

Given the limited resources for Python development, how much time
should be spent on this?  I think very little.  As Tim Peters once
pointed out, there haven't been problems with Python's optimization
code <wink>.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list