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 scoder, serhiy.storchaka, vstinner
Date 2016-08-22.09:05:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Extensive callback interfaces like map() come to mind, where a large number of calls becomes excessively time critical and might thus have made people implement their own special purpose calling code.

I didn't patch map_next() of Python/bltinmodule.c nor list.sort() for use fast call yet. With my full patch, map() and list.sort() are *faster*, but even more changes are needed ;-)

- map(lambda x: x, list(range(1000))): 18% faster
- sorted(list, key=lambda x: x): 33% faster

I'm now aware of map() or list.sort()/sorted() function rewritten from scratch for better performance, but I can imagine that someone did that. But do these specialized implementation use PyObject_Call() or "inline" PyCFunction_Call()?

If someone "inlines" PyCFunction_Call(), be prepared to "backward incompatible changes", since it's common that CPython internals change in a subtle way.

> However, I don't know any such code (outside of Cython)

I used GitHub to search for such code using "case METH_VARARGS". I found:

* (many copies of the CPython source code)
* : ironclad is a module to call C extensions from IronPython, the last commit of the project was in 2011...
* : copy of the psyco module. The last commit in pysco was also in 2011,

In short, I found nothing. But I didn't search far, maybe there are a few other code bases using "case METH_VARARGS:"?
Date User Action Args
2016-08-22 09:05:24vstinnersetrecipients: + vstinner, scoder, serhiy.storchaka
2016-08-22 09:05:24vstinnersetmessageid: <>
2016-08-22 09:05:24vstinnerlinkissue27810 messages
2016-08-22 09:05:24vstinnercreate