Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python.': 0.04; 'cpython': 0.05; 'subject:Python': 0.06; 'definitions': 0.07; 'imports': 0.07; 'python': 0.08; 'subject:features': 0.09; 'to:name:python- list': 0.19; 'language': 0.21; 'objects,': 0.23; 'pieces': 0.23; 'libraries': 0.25; 'expect': 0.25; 'moving': 0.25; 'function': 0.26; 'thanks.': 0.26; 'message-id:@mail.gmail.com': 0.28; 'class': 0.31; 'least': 0.31; 'pure': 0.32; 'to:addr:python-list': 0.34; 'that,': 0.35; 'optimization': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.38; 'could': 0.38; 'think': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'here': 0.66; 'due': 0.66; 'received:209.85.215.174': 0.67; 'received:mail- ey0-f174.google.com': 0.67; 'heavy': 0.71; 'performance:': 0.84; 'contrast': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=WL3wD62zFd1Lu85og+D0FILgeXINH5FBmFhwTAw4E/4=; b=YZhgY0XyE+3BHm7r/47OXGFDvIq2ZuOuNgJeNFRanqqaAOYsMFEcXxBJEnQn/eutth NLtiMyUarIjoPTNjComuaSzYMhyeb9kLHy97c7tkGOUkWkd3PrJ8sCScX3LqCvJyIdc2 6vNfAIV1TQJdZ9PWats+8Fx/d3EfaWkhbUjpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=jiGdyHwy92Vz1JA2qQgxl9QsxiXB0G5iHNpE4OZ2B2WRQIEOsE8CDEXckxrdiBSky3 7ELZBt57AFPM42o303KHdpS/m3uTgworH0M5SgM085+Jamx4eK/25WrWdJjtPiwC7jV7 GaZV2iVNLh4q8RHUi59JfkDHVxLX5v17nS3c0= MIME-Version: 1.0 Date: Thu, 23 Jun 2011 10:58:06 -0600 Subject: performance critical Python features From: Eric Snow To: python-list Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308848288 news.xs4all.nl 14144 [::ffff:82.94.164.166]:56412 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8313 I was thinking about the different features of Python that have an impact on performance. Here are the obvious ones I could think of: Features most impactful on performance: - function calls - loops Features least impactful on performance: - imports - function definitions - class definitions A key point is that CPython has special-case optimization for functions (code objects, locals, and eval) and loops (comprehensions, generators, and iterators). Also, other libraries are optimized via C-extensions to be efficient, I expect due to their use in loops. In contrast to that, the machinery behind language features like imports are moving to pure Python. So, which are the other pieces of Python that really need the heavy optimization and which are those that don't? Thanks. -eric