Message273341
> 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 ;-)
https://bugs.python.org/issue26814#msg263999
- 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)
* https://github.com/jhgameboy/ironclad/blob/5892c43b540b216d638e0fed2e6cf3fd8289fdfc/src/CallableBuilder.cs : ironclad is a module to call C extensions from IronPython, the last commit of the project was in 2011...
* https://github.com/pepsipepsi/nodebox_opengl_python3/blob/cfb2633df1055a028672b11311603cc2241a1378/nodebox/ext/psyco/src/c/Objects/pmethodobject.c : copy of the psyco module. The last commit in pysco was also in 2011, https://bitbucket.org/arigo/psyco/commits/all
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:24 | vstinner | set | recipients:
+ vstinner, scoder, serhiy.storchaka |
2016-08-22 09:05:24 | vstinner | set | messageid: <1471856724.33.0.793656509107.issue27810@psf.upfronthosting.co.za> |
2016-08-22 09:05:24 | vstinner | link | issue27810 messages |
2016-08-22 09:05:24 | vstinner | create | |
|