You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 faster-cpython/ideas#54 (comment) for the benchmark script and results.
This issue is also tied to bpo-44207 (Add a version number to Python functions) which will be required for specializations 1 and 2.
Unfortunately, PR 26934 has broken thes 390x RHEL7 LTO 3.x buildbot as you can see before. As per the buildbot maintenance procedures, we will need to revert this PR unless is fixed in 24 hours.
New changeset 135cabd by Mark Shannon in branch 'main': bpo-44525: Copy free variables in bytecode to allow calls to inner functions to be specialized (GH-29595) 135cabd
New changeset 3a60bfe by Mark Shannon in branch 'main': bpo-44525: Specialize for calls to type and other builtin classes with 1 argument. (GH-29942) 3a60bfe
Activity
Fidget-Spinner commentedon Jun 28, 2021
CALL_FUNCTION can be specialized. Copying from Mark's comments faster-cpython/ideas#54 (comment)
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 faster-cpython/ideas#54 (comment) for the benchmark script and results.
This issue is also tied to bpo-44207 (Add a version number to Python functions) which will be required for specializations 1 and 2.
markshannon commentedon Oct 19, 2021
New changeset 3163e68 by Ken Jin in branch 'main':
bpo-44525: Specialize
CALL_FUNCTIONfor C function calls (GH-26934)3163e68
markshannon commentedon Oct 20, 2021
New changeset 8863a0f by Mark Shannon in branch 'main':
bpo-44525: Specialize simple Python calls. (GH-29033)
8863a0f
pablogsal commentedon Oct 27, 2021
Unfortunately, PR 26934 has broken thes 390x RHEL7 LTO 3.x buildbot as you can see before. As per the buildbot maintenance procedures, we will need to revert this PR unless is fixed in 24 hours.
@markshannon @Fidget-Spinner
markshannon commentedon Oct 28, 2021
New changeset 0a1a36b by Ken Jin in branch 'main':
bpo-44525: Add recursive checks for
CALL_FUNCTION_BUILTIN_O(GH-29271)0a1a36b
markshannon commentedon Nov 23, 2021
New changeset 135cabd by Mark Shannon in branch 'main':
bpo-44525: Copy free variables in bytecode to allow calls to inner functions to be specialized (GH-29595)
135cabd
markshannon commentedon Dec 14, 2021
New changeset 9f8f451 by Mark Shannon in branch 'main':
bpo-44525: Split calls into PRECALL and CALL (GH-30011)
9f8f451
markshannon commentedon Dec 15, 2021
New changeset 3a60bfe by Mark Shannon in branch 'main':
bpo-44525: Specialize for calls to type and other builtin classes with 1 argument. (GH-29942)
3a60bfe
markshannon commentedon Jan 5, 2022
See faster-cpython/ideas#210
iritkatriel commentedon Sep 9, 2022
Is there anything left to do on this?
pablogsal commentedon Sep 10, 2022
Closing. Please feel free to re-open if we missed anything.
GH-88691: Shrink the CALL caches (GH-103230)
pythonGH-88691: Shrink the CALL caches (pythonGH-103230)
pythonGH-88691: Shrink the CALL caches (pythonGH-103230)