This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients methane, python-dev, rhettinger, serhiy.storchaka, vstinner, yselivanov
Date 2017-02-09.22:14:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486678472.84.0.763920145268.issue29507@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-02-09 22:14:32vstinnersetrecipients: + vstinner, rhettinger, methane, python-dev, serhiy.storchaka, yselivanov
2017-02-09 22:14:32vstinnersetmessageid: <1486678472.84.0.763920145268.issue29507@psf.upfronthosting.co.za>
2017-02-09 22:14:32vstinnerlinkissue29507 messages
2017-02-09 22:14:32vstinnercreate