Felipe Almeida Lessa wrote: > Em Dom, 2006-02-12 às 23:51 -0500, Steve Holden escreveu: > >>The basic answer is that so far no developer has felt it worthwhile to >>expend time on adding these optimizations. > > > I always thought these small optimizations could lead Python to be > faster overall. I remember about this every time I see CPython vs. > IronPython benchmarks (.NET and Mono do some nice optimizations at > compile and run times). > Indeed it is true that on some benchmarks IronPython is faster than CPython. I suspect this was helped by the fact that IronPython is Jim's third implementation of Python (I believe he was familiar with CPython before he started on Jython, formerly known as JPython).
The fact remains that until someone writes the code it can't be included in the implementation. Performance optimization, unfortunately, doesn't have the same glamorous cachet as more esoteric language features. > >>>Also, IIRC Psyco does optimize these constant expressions. Or am I >>>wrong? >>> >> >>Psyco does some very advanced things, but it does them all at run-time. >>Unless I misunderstand (not unheard of), there are no circumstances >>under which Psyco will improve run-time for a piece of code that is only >>executed once. > > > Sorry, I think I should have been clearer. Yes, Psyco only helps at > runtime (when the function is called), but those constant folds only > practically help on parts of the code that are called many times anyway, > right? > Right. Technically constant folding is a win for a single execution, but only if you don't take the slightly-increased compile time into account :-) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list