GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — gh-87613: AC VC add support for *args and use it for zip by cmaloney · Pull Request #160944 · python/cpython Conversation
|
| 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:
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')
Sorry, something went wrong.
There was an error while loading. Please reload this page.
`@vectorcall` accepted `*args`, but the generated code expected an args tuple. Use fastcall form to parse the args array. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Stan Ulbrych <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'll leave this for you to merge. :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.