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 kj
Recipients Mark.Shannon, kj
Date 2021-06-28.14:22:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624890138.2.0.824780513801.issue44525@roundup.psfhosted.org>
In-reply-to
Content
CALL_FUNCTION can be specialized. Copying from Mark's comments https://github.com/faster-cpython/ideas/issues/54#issue-898013125

```
There are a number of specializations of CALL_FUNCTION that make sense:

1. Calls to a Python function where the arguments and parameters match exactly.
2. Calls to a Python function with keyword arguments, or defaults, when the argument shuffle can be pre-computed.
3. Calls to builtin functions.
4. Calls to specific builtin functions, specifically len and instance.
5. Calls to type with a single argument.
6. Instantiation of a "normal" class, that is a class that does not redefine __new__ and whose metaclass is type.
```

I've prepared a PR that should speed up non-keyword calls to PyCFunction. It covers specializations 3 and 4. Stable pyperf microbenchmarks show 5-15% less call overhead for some PyCFunctions. Please see https://github.com/faster-cpython/ideas/issues/54#issuecomment-868978681 for the benchmark script and results.

This issue is also tied to issue44207 (Add a version number to Python functions) which will be required for specializations 1 and 2.
History
Date User Action Args
2021-06-28 14:22:18kjsetrecipients: + kj, Mark.Shannon
2021-06-28 14:22:18kjsetmessageid: <1624890138.2.0.824780513801.issue44525@roundup.psfhosted.org>
2021-06-28 14:22:18kjlinkissue44525 messages
2021-06-28 14:22:17kjcreate