Skip to content

gh-162350: Add AC vectorcall for io.IncrementalNewlineDecoder - #162508

Merged
cmaloney merged 2 commits into
python:mainfrom
tanloong:incrementalnewlinedecoder_vectorcall
Nov 25, 2026
Merged

cmaloney merged 2 commits into
python:mainfrom
tanloong:incrementalnewlinedecoder_vectorcall

Conversation

@tanloong

@tanloong tanloong commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Add @vectorcall to the AC-generated IncrementalNewlineDecoder.__init__. There is no change of exception text for bad arguments.

Benchmark:

+----------------------------------------+--------+----------------------+
| Benchmark                              | main   | patch                |
+========================================+========+======================+
| IncrementalNewlineDecoder(None, False) | 145 ns | 116 ns: 1.25x faster |
+----------------------------------------+--------+----------------------+
| IncrementalNewlineDecoder(None, True)  | 142 ns | 116 ns: 1.22x faster |
+----------------------------------------+--------+----------------------+
| Geometric mean                         | (ref)  | 1.24x faster         |
+----------------------------------------+--------+----------------------+
Details
import pyperf

SETUP = """
from io import IncrementalNewlineDecoder
"""

CASES = [
    ('IncrementalNewlineDecoder(None, False)', 'IncrementalNewlineDecoder(None, False)'),
    ('IncrementalNewlineDecoder(None, True)', 'IncrementalNewlineDecoder(None, True)')
]

runner = pyperf.Runner()
for name, stmt in CASES:
    runner.timeit(name, stmt=stmt, setup=SETUP)

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please regenerate clinic files

@tanloong

Copy link
Copy Markdown
Contributor Author

Regenerated and conflict now resolved.

@cmaloney
cmaloney merged commit 0b6ead6 into python:main Nov 25, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants