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


Groups > comp.lang.python > #10797 > unrolled thread

Re: Early binding as an option

Started byThomas Jollans <t@jollybox.de>
First post2011-08-03 12:00 +0200
Last post2011-08-03 12:00 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#10797 — Re: Early binding as an option

FromThomas Jollans <t@jollybox.de>
Date2011-08-03 12:00 +0200
SubjectRe: Early binding as an option
Message-ID<mailman.1830.1312365594.1164.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web