Repository navigation
Commit 6d31270
`@vectorcall` accepted `*args`, but the generated code expected an
args tuple. Use fastcall form to parse the args array.
zip had no vectorcall, so every call built an args tuple and a kwargs
dict, and strict=True also went through PyArg_ParseTupleAndKeywords with
a temporary empty tuple. Argument error messages are unchanged except
for unknown keywords: `zip(strict=1, x=2)` now reports "got an
unexpected keyword argument 'x'" instead of "takes at most 1 keyword
argument (2 given)". The docstring gains a summary line;
`__text_signature__` is unchanged.
pyperf microbenchmark (PGO+LTO, run serially):
| Benchmark | base | zip |
|------------------------|:-------:|:---------------------:|
| zip(a, b, strict=True) | 118 ns | 61.5 ns: 1.92x faster |
| zip(a, b) | 64.9 ns | 53.1 ns: 1.22x faster |
| zip(a) | 55.0 ns | 47.1 ns: 1.17x faster |
| list(zip(a, b)) | 123 ns | 113 ns: 1.09x faster |
| zip() | 27.4 ns | 25.7 ns: 1.07x faster |
| Sub(a, b) | 71.5 ns | 70.6 ns: 1.01x faster |
Benchmark hidden because not significant (1): zip.`__new__`
Benchmark code:
```python
import pyperf
runner = pyperf.Runner()
setup = "a = (1, 2, 3); b = [4, 5, 6]"
for stmt in ["zip()", "zip(a)", "zip(a, b)", "zip(a, b, strict=True)",
"list(zip(a, b))"]:
runner.timeit(stmt, stmt, setup)
runner.timeit('zip.`__new__`', 'new(zip, a, b)', setup + '; new = zip.__new__')
runner.timeit('Sub(a, b)', 'S(a, b)', setup + '\nclass S(zip): pass')
```
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent ce841a9 commit 6d31270
4 files changed
Lines changed: 188 additions & 54 deletions
File tree
- Lib/test
- Python
- clinic
- Tools/clinic/libclinic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5220 | 5220 | | |
5221 | 5221 | | |
5222 | 5222 | | |
| 5223 | + | |
5223 | 5224 | | |
5224 | 5225 | | |
5225 | 5226 | | |
| |||
5261 | 5262 | | |
5262 | 5263 | | |
5263 | 5264 | | |
| 5265 | + | |
| 5266 | + | |
| 5267 | + | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
| 5271 | + | |
| 5272 | + | |
| 5273 | + | |
| 5274 | + | |
| 5275 | + | |
| 5276 | + | |
| 5277 | + | |
| 5278 | + | |
| 5279 | + | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
| 5285 | + | |
| 5286 | + | |
| 5287 | + | |
| 5288 | + | |
| 5289 | + | |
| 5290 | + | |
| 5291 | + | |
| 5292 | + | |
5264 | 5293 | | |
5265 | 5294 | | |
5266 | | - | |
| 5295 | + | |
5267 | 5296 | | |
5268 | 5297 | | |
5269 | 5298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3139 | 3139 | | |
3140 | 3140 | | |
3141 | 3141 | | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
3142 | 3165 | | |
3143 | | - | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
3144 | 3169 | | |
3145 | 3170 | | |
3146 | 3171 | | |
3147 | 3172 | | |
3148 | 3173 | | |
3149 | | - | |
3150 | | - | |
3151 | | - | |
3152 | | - | |
3153 | | - | |
3154 | | - | |
3155 | | - | |
3156 | | - | |
3157 | | - | |
3158 | | - | |
3159 | | - | |
3160 | | - | |
3161 | | - | |
3162 | | - | |
3163 | | - | |
3164 | | - | |
3165 | | - | |
3166 | | - | |
3167 | | - | |
3168 | | - | |
3169 | 3174 | | |
3170 | 3175 | | |
3171 | | - | |
| 3176 | + | |
3172 | 3177 | | |
3173 | 3178 | | |
3174 | | - | |
3175 | | - | |
3176 | | - | |
| 3179 | + | |
| 3180 | + | |
3177 | 3181 | | |
3178 | 3182 | | |
3179 | 3183 | | |
| |||
3182 | 3186 | | |
3183 | 3187 | | |
3184 | 3188 | | |
3185 | | - | |
| 3189 | + | |
3186 | 3190 | | |
3187 | 3191 | | |
3188 | 3192 | | |
3189 | 3193 | | |
3190 | | - | |
| 3194 | + | |
3191 | 3195 | | |
3192 | 3196 | | |
3193 | 3197 | | |
| |||
3199 | 3203 | | |
3200 | 3204 | | |
3201 | 3205 | | |
3202 | | - | |
| 3206 | + | |
3203 | 3207 | | |
3204 | 3208 | | |
3205 | 3209 | | |
| |||
3345 | 3349 | | |
3346 | 3350 | | |
3347 | 3351 | | |
3348 | | - | |
3349 | | - | |
3350 | | - | |
3351 | | - | |
3352 | | - | |
3353 | | - | |
3354 | | - | |
3355 | | - | |
3356 | | - | |
3357 | | - | |
3358 | | - | |
3359 | | - | |
3360 | | - | |
3361 | | - | |
3362 | | - | |
3363 | 3352 | | |
3364 | 3353 | | |
3365 | 3354 | | |
| |||
3383 | 3372 | | |
3384 | 3373 | | |
3385 | 3374 | | |
3386 | | - | |
| 3375 | + | |
3387 | 3376 | | |
3388 | 3377 | | |
3389 | 3378 | | |
| |||
3402 | 3391 | | |
3403 | 3392 | | |
3404 | 3393 | | |
| 3394 | + | |
3405 | 3395 | | |
3406 | 3396 | | |
3407 | 3397 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
923 | 923 | | |
924 | 924 | | |
925 | 925 | | |
926 | | - | |
| 926 | + | |
927 | 927 | | |
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
932 | 932 | | |
933 | | - | |
| 933 | + | |
934 | 934 | | |
935 | 935 | | |
936 | 936 | | |
| |||
963 | 963 | | |
964 | 964 | | |
965 | 965 | | |
| 966 | + | |
966 | 967 | | |
967 | 968 | | |
968 | 969 | | |
| |||
995 | 996 | | |
996 | 997 | | |
997 | 998 | | |
998 | | - | |
999 | | - | |
| 999 | + | |
| 1000 | + | |
1000 | 1001 | | |
1001 | 1002 | | |
1002 | 1003 | | |
| |||
1090 | 1091 | | |
1091 | 1092 | | |
1092 | 1093 | | |
1093 | | - | |
| 1094 | + | |
1094 | 1095 | | |
1095 | 1096 | | |
1096 | 1097 | | |
| |||
1148 | 1149 | | |
1149 | 1150 | | |
1150 | 1151 | | |
1151 | | - | |
| 1152 | + | |
| 1153 | + | |
1152 | 1154 | | |
1153 | 1155 | | |
1154 | 1156 | | |
| |||
1376 | 1378 | | |
1377 | 1379 | | |
1378 | 1380 | | |
1379 | | - | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1380 | 1387 | | |
1381 | 1388 | | |
1382 | 1389 | | |
| |||
1617 | 1624 | | |
1618 | 1625 | | |
1619 | 1626 | | |
| 1627 | + | |
| 1628 | + | |
1620 | 1629 | | |
1621 | | - | |
| 1630 | + | |
| 1631 | + | |
1622 | 1632 | | |
1623 | 1633 | | |
1624 | 1634 | | |
| |||
0 commit comments