gh-90370: avoid temporary tuple creation for vararg in AC by skirpichev · Pull Request #126064 · python/cpython

@skirpichev

Current patch partially address issue, working in case when all
arguments either positional-only or vararg.

This also converts gcd(), lcm() and hypot() functions of the math module
to the Argument Clinic.  Fix issue python#101123.

Objects/setobject.c and Modules/gcmodule.c adapted.  This fixes slight
performance regression for set methods, introduced by
python#115112:

| Benchmark            | ref    | patch                |
|----------------------|:------:|:--------------------:|
| set().update(s1, s2) | 354 ns | 264 ns: 1.34x faster |

Benchmark code:
```py
import pyperf
s1, s2 = {1}, {2}
runner = pyperf.Runner()
runner.bench_func('set().update(s1, s2)', set().update, s1, s2)
```

@bedevere-app bot mentioned this pull request

Oct 28, 2024

@skirpichev

@skirpichev

erlend-aasland

@skirpichev

erlend-aasland

@skirpichev

@skirpichev

erlend-aasland

erlend-aasland

@skirpichev

erlend-aasland

@skirpichev

@skirpichev

erlend-aasland

erlend-aasland

serhiy-storchaka

picnixz pushed a commit to picnixz/cpython that referenced this pull request

Dec 8, 2024
…arargs (python#126064)

Avoid temporary tuple creation when all arguments either positional-only
or vararg.

Objects/setobject.c and Modules/gcmodule.c adapted. This fixes slight
performance regression for set methods, introduced by pythongh-115112.

ebonnal pushed a commit to ebonnal/cpython that referenced this pull request

Jan 12, 2025
…arargs (python#126064)

Avoid temporary tuple creation when all arguments either positional-only
or vararg.

Objects/setobject.c and Modules/gcmodule.c adapted. This fixes slight
performance regression for set methods, introduced by pythongh-115112.