One Python 2.1 idea

rturpin at my-deja.com rturpin at my-deja.com
Tue Dec 26 15:51:43 CET 2000


In article <929n9c013m3 at news1.newsguy.com>,
  "Alex Martelli" <aleaxit at yahoo.com> wrote:
> No implicit caching.

Has there been some discussion about caching? If done
well, the vast majority of references would reach
their object's attribute or method for the cost of a
couple of integer compares and array fetches. This
should be an order of magnitude faster than string
lookup in a dictionary. This especially benefits
method invocation, since that costs a failed lookup
to the instance dictionary, and a successful lookup
in the class dictionary. That's almost enough to
scare me away from methods!

Most work in a Python program involves object methods
or attributes. (At least, this is the case in my
programs. ;-) Increasing the speed of reference to
these should have appreciable benefit, across the
board. Yeah, it would make the code a bit more
complex to maintain. But this isn't a special case --
it is a general mechanism central to how Python works.

Russell





Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list