Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10797

Re: Early binding as an option

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'parser': 0.05; 'function,': 0.07; 'interpreter': 0.07; 'raises': 0.07; 'python': 0.08; 'fetch': 0.09; 'sure)': 0.09; 'though:': 0.09; 'wrote:': 0.15; "didn't,": 0.16; 'lookup': 0.16; 'pointers': 0.16; 'received:192.168.1.40': 0.16; 'subject:Early': 0.16; "wouldn't": 0.17; 'variable': 0.21; 'header:In-Reply-To:1': 0.22; 'smart': 0.23; "i'm": 0.27; 'compile': 0.29; 'array': 0.30; 'can.': 0.30; 'chris': 0.32; 'to:addr:python-list': 0.34; 'instead': 0.34; 'header:User-Agent:1': 0.34; 'it?': 0.34; 'difference': 0.34; 'anything': 0.37; 'but': 0.37; 'could': 0.37; 'received:192': 0.38; 'not,': 0.38; 'subject:: ': 0.38; 'something': 0.38; 'two': 0.38; 'perhaps': 0.39; 'received:192.168.1': 0.39; 'to:addr:python.org': 0.39; 'might': 0.39; 'where': 0.40; 'enough,': 0.64; 'ever': 0.65; 'received:62': 0.67; 'guarantee': 0.69; 'difficult,': 0.84; 'from:addr:t': 0.84; 'locals': 0.84; 'technique': 0.93
Date Wed, 03 Aug 2011 12:00:05 +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> <j19mbp$985$1@dough.gmane.org> <CAPTjJmr8mjYKTYu9EdKc-QRaFfSwH0rbVdAhnW-ysfvOZujJqQ@mail.gmail.com>
In-Reply-To <CAPTjJmr8mjYKTYu9EdKc-QRaFfSwH0rbVdAhnW-ysfvOZujJqQ@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.1830.1312365594.1164.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1312365594 news.xs4all.nl 23894 [2001:888:2000:d::a6]:44769
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10797

Show key headers only | View raw


On 03/08/11 00:08, Chris Angelico wrote:
> With the local-variable-snapshot technique ("len = len"), can anything
> be optimized, since the parser can guarantee that nothing ever
> reassigns to it? If not, perhaps this would be a place where something
> might be implemented:
> [...]

Yes, it can. The parser can know when it is reassigned to just by
looking at the one function, and even if it didn't, or if it were
reassigned, it wouldn't make much of a difference because the
interpreter would still only have to fetch one of a set of locals known
at compile time, which can be (is? I'm not sure) as simple as an array
lookup: two pointers being dereferences instead of one.

Chris Rebert raises a very important point though: Python dynamic
namespaces make optimising variable lookup comparatively difficult, but
not impossible: good JavaScript JITs are smart enough, so a good Python
JIT could be as well.

Thomas

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Early binding as an option Thomas Jollans <t@jollybox.de> - 2011-08-03 12:00 +0200

csiph-web