Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue6033] LOOKUP_METHOD and CALL_METHOD optimization

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 24, 2009, 9:15 AM

Post #1 of 3 (211 views)
Permalink
[issue6033] LOOKUP_METHOD and CALL_METHOD optimization

Changes by Reid Kleckner <rnk [at] mit>:


----------
nosy: +rnk

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 24, 2009, 6:21 PM

Post #2 of 3 (194 views)
Permalink
[issue6033] LOOKUP_METHOD and CALL_METHOD optimization [In reply to]

Reid Kleckner <rnk [at] mit> added the comment:

One thing I was wondering about the current patch is what about objects
that have attributes that shadow methods? For example:

class C(object):
def foo(self):
return 1
c = c()
print c.foo()
c.foo = lambda: 2
print c.foo()

Shouldn't the above print 1 and 2? With the current patch, it seems
that you might still print 1.

There's also the possible performance drawback where you're loading
builtin C methods, so the optimization fails, but you end up calling
_PyType_Lookup twice. :(

I'm doing the same optimization for unladen swallow, and these were some
of the things I ran into. I think I'm going to write a
PyObject_GetMethod that tries to get a method without binding it, but if
it can't for any reason, it behaves just like PyObject_GetAttr and sets
a status code.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 24, 2009, 7:27 PM

Post #3 of 3 (191 views)
Permalink
[issue6033] LOOKUP_METHOD and CALL_METHOD optimization [In reply to]

Benjamin Peterson <benjamin [at] python> added the comment:

Yes, my patch introduces that regression you mention. PyPy solves this
by having the instances dictionary keep track of shadowing of the type
dictionary. Not easy for CPython... I wish you luck on your patch!

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue6033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.