[New-bugs-announce] [issue31543] Optimize wrapper descriptors using FASTCALL

STINNER Victor report at bugs.python.org
Thu Sep 21 09:25:31 EDT 2017

New submission from STINNER Victor:

Attached pull request adds a fastpath for wrapper descriptors to use the FASTCALL calling convention. It's a follow up of bpo-31410 and all my work on FASTCALL during Python 3.6 and 3.7 development cycles.


./python -m perf timeit -s 'import array; obj=array.array("b"); wrap=array.array.__len__' 'wrap(obj)'


haypo at selma$ ./python -m perf compare_to ref.json patch.json 
Mean +- std dev: [ref] 59.2 ns +- 0.6 ns -> [patch] 28.2 ns +- 0.9 ns: 2.10x faster (-52%)

It removes 31 nanoseconds on such very fast C function, array_length().

Attached PR is still a work-in-progress. First I would like to know if it's worth it because working on polishing the actual code.

components: Interpreter Core
messages: 302692
nosy: haypo, inada.naoki, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize wrapper descriptors using FASTCALL
type: performance
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list