[New-bugs-announce] [issue34838] Improve arg clinic code generation for cases with type checking

Raymond Hettinger report at bugs.python.org
Fri Sep 28 17:15:58 EDT 2018


New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:

An arg clinic specification such as

    p: object(subclass_of='&PyTuple_Type')

generates slow code using _PyArg_ParseStack() that has to parse a format string like "O!" to decide to make a type check.  Instead, it should directly generate a branch-predictable test for the type check and then call the much quicker function _PyArg_UnpackStack().

See https://github.com/python/cpython/pull/9628 for an example of this change giving a 30% speedup.

----------
components: Argument Clinic
messages: 326659
nosy: larry, rhettinger, serhiy.storchaka, vstinner
priority: low
severity: normal
status: open
title: Improve arg clinic code generation for cases with type checking
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34838>
_______________________________________


More information about the New-bugs-announce mailing list