STINNER Victor added the comment:

Raymond Hettinger: "+1 Though this is a rather large and impactful patch, I 
think it is a great idea.  It will be one of the highest payoff applications of 
FASTCALL, broadly benefitting a lot of code."

In my experience, avoiding temporary tuple to pass positional arguments 
provides a speedup to up 30% faster in the best case. Here it's 1.5x faster 
because the optimization also avoids the creation of temporary PyMethodObject.


"Let's be sure to be extra careful with this one because it is touching central 
parts of the language, so any errors or subtle behavior changes will be felt by 
a lot of code, some of which is sure to hit the rare corner cases and to rely 
on implementation details."

I reviewed Naoki's patch carefully, but in fact it isn't as big as I expected.

In Python 3.6, call_method() calls tp_descr_get of PyFunction_Type which 
creates PyMethodObject. The tp_call of PyMethodObject calls the function with 
self, nothing crazy.

The patch removes a lot of steps and (IMHO) makes the code simpler than before 
(when calling Python methods).

I'm not saying that such change is bugfree-proof :-) But we are far from Python 
3.7 final, so it's the right time to push such large optimization.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29507>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to