A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-February/019867.html below:

[Python-Dev] Speeding up instance attribute access

[Python-Dev] Speeding up instance attribute access [Python-Dev] Speeding up instance attribute accessNeal Norwitz neal@metaslash.com
Fri, 08 Feb 2002 16:10:25 -0500
Guido van Rossum wrote:

> - The required global analysis is a bit hairy, and not something we
>   already do.  I believe that Jeremy thinks PyChecker already does
>   this; I'm not sure if that means we can borrow code or just ideas.

The algorithm pychecker uses is pretty simple.  
I think something like this should work:

	for each method:
	    self = method.co_varnames[0]
	    for each byte code in method:
		if op == STORE_FAST and oparg == self:
		    break # we don't know self anymore

		if (op == STORE_ATTR or op == LOAD_ATTR) and selfOnTop:
		    # we have an attribute store it off
		selfOnTop = (LOAD_FAST and oparg == self)

Note that storing the attributes could be done during the compilation step.
This means that it should be simple housekeeping in the compiler to store
the info and not require another pass (as in pychecker).

Neal



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4