Showing content from http://mail.python.org/pipermail/python-dev/attachments/20100408/3bd54bc1/attachment.html below:
2010/4/7 Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, 6 Apr 2010 04:25:08 pm Cesare Di Mauro wrote:<br>
<br>
> It will certainly. There's MUCH that can be optimized to let CPython<br>
> squeeze more performance from static analysis (even a gross one) on<br>
> locals.<br>
</div>[...]<br>
<div class="im">> They are just "dummy" examples, but can make it clear how far<br>
> optimizations can go with static analysis on locals. Python is a<br>
> language that make it possible to use such analysis at compile time,<br>
> and I think it is a very good thing.<br>
<br>
</div>I'm not opposed to the idea of optimisations in general (far from it!)<br>
but in case anyone is thinking about doing any work in this area,<br>
please be careful about floating point optimisations. E.g. given a float<br>
x, you can't assume that x*0 == 0. Nor can you assume that 0-x is the<br>
same as -x. (The second is *almost* always correct, except for one<br>
float value.)<br>
<br>
See, for example, the various writings by Professor Kahan:<br>
<br>
<a href="http://www.drdobbs.com/184410314" target="_blank">http://www.drdobbs.com/184410314</a><br>
<a href="http://www.cs.berkeley.edu/~wkahan/" target="_blank">http://www.cs.berkeley.edu/~wkahan/</a><br>
<br>
Most of the issues discussed apply to languages that deal with floats at<br>
a lower level than Python does, but still, simple minded optimizations<br>
will break corner cases no matter what language you use.<br>
<br>
--<br>
<font color="#888888">Steven D'Aprano</font></blockquote><div><br></div><div>Thanks for the useful links.</div><div><br></div><div>I never applied such kind of optimizations, and I think I'll never to do it anyway. :)</div>
<div><br></div><div>Cesare</div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4