Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10755
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <t@jollybox.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'help?': 0.03; 'cpython': 0.05; 'suppose': 0.05; 'sure.': 0.05; 'compiler': 0.07; 'interpreter': 0.07; 'python': 0.08; 'dict': 0.09; 'global,': 0.09; 'interpreter,': 0.09; 'namespace': 0.09; 'wrote:': 0.15; 'ideas?': 0.16; 'len': 0.16; 'lookup': 0.16; 'lot;': 0.16; 'received:192.168.1.40': 0.16; 'subject:Early': 0.16; 'object,': 0.16; 'pm,': 0.16; 'aug': 0.19; 'operations.': 0.19; '(which': 0.20; 'header:In-Reply-To:1': 0.22; 'assume': 0.23; 'uses.': 0.23; 'tue,': 0.23; 'modules': 0.25; 'string': 0.26; 'function': 0.26; 'replaced': 0.29; 'object': 0.30; "it'd": 0.30; 'chris': 0.32; 'done,': 0.32; 'does': 0.32; 'it.': 0.33; 'actually': 0.33; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'normally': 0.34; "isn't": 0.35; 'actual': 0.35; 'some': 0.37; 'doing': 0.37; 'but': 0.37; 'could': 0.37; 'received:192': 0.38; 'takes': 0.38; 'subject:: ': 0.38; 'run': 0.39; 'received:192.168.1': 0.39; 'help': 0.39; 'either': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'where': 0.40; 'kind': 0.60; 'address': 0.61; 'direct': 0.66; 'straight': 0.66; 'received:62': 0.67; 'profile': 0.71; 'introduce': 0.79; "(don't": 0.84; 'from:addr:t': 0.84; 'lookup,': 0.84; 'profiling': 0.84; 'significant.': 0.84 |
| Date | Tue, 02 Aug 2011 20:10:15 +0200 |
| From | Thomas Jollans <t@jollybox.de> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110628 Thunderbird/5.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Early binding as an option |
| References | <CAPTjJmpWN1Tq-46UoHjh_-q9ahkivTWmLJR3_eF9iThHwXQnhA@mail.gmail.com> <4E38315C.1000102@jollybox.de> <CAPTjJmqfi8YfSYU8wHMZCxQ-3iYim+TOfq9qwn3MOq695R2Cgw@mail.gmail.com> |
| In-Reply-To | <CAPTjJmqfi8YfSYU8wHMZCxQ-3iYim+TOfq9qwn3MOq695R2Cgw@mail.gmail.com> |
| X-Enigmail-Version | 1.2 |
| OpenPGP | id=5C8691ED |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1797.1312308603.1164.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1312308603 news.xs4all.nl 23923 [2001:888:2000:d::a6]:38053 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10755 |
Show key headers only | View raw
On 02/08/11 19:42, Chris Angelico wrote: > On Tue, Aug 2, 2011 at 6:18 PM, Thomas Jollans <t@jollybox.de> wrote: >> I suppose it would be possible to introduce a kind of "constant >> globals" namespace that a JIT compiler could then use to optimise, but >> how much would this help? > > Surely it must help a lot; looking up names is string operations. If > "len" could be replaced with "@10794928" where 10794928 is the actual > address of the len object, then it'd be doing no work that isn't > normally done, and would go straight to the object and call it. > > But I don't really know how to go about profiling this to be sure. Any ideas? Well, you could run a direct comparison of one function where len is global, and an identitical function where len is local (which does not do a dict lookup, am I right?) Of course the global dict lookup takes time, but I doubt that many modules look up the same name often enough for it to actually be significant. I don't really know enough about either profiling or the CPython interpreter, but I assume there's some function that's called to look up globals; you could profile the Python interpreter (don't ask me with which tool) and see how much time that function uses. Thomas
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Early binding as an option Thomas Jollans <t@jollybox.de> - 2011-08-02 20:10 +0200
csiph-web