[Python-Dev] python optimization (original) (raw)
Chris Cioffi evenprimes at gmail.com
Thu Sep 15 14:56:24 CEST 2005
- Previous message: [Python-Dev] python optimization
- Next message: [Python-Dev] python optimization
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 highly optimised languages in the world along the Programmer Productivity metric. Line for line, you can pack more readable, obvious, and maintainable meaning into Python than pretty much any other language. The upshot is that then you can profile the final running code and see if it really matters that the compiler is using an extra .034 microseconds.
That's my $0.028 US (damn inflation!) On 15/09/05, Neal Becker <ndbecker2 at gmail.com> 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 removed from loops. In general, an entity is defined as close to the point of usage as possible. I don't know to what extent these kind of optimizations are available to cpython. For example, are constant calculations removed from loops? How about functions? Is there a significant cost to putting a function def inside a loop rather than outside? -- http://mail.python.org/mailman/listinfo/python-list
-- "A little government and a little luck are necessary in life, but only a fool trusts either of them." -- P. J. O'Rourke -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20050915/a79ca53b/attachment.html
- Previous message: [Python-Dev] python optimization
- Next message: [Python-Dev] python optimization
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]