New submission from Raymond Hettinger <raymond.hettin...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue34838>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to