Skip to content

gh-162350: Add AC vectorcall for zoneinfo.ZoneInfo - #162503

Merged
asvetlov merged 1 commit into
python:mainfrom
tanloong:zoneinfo_vectorcall
Nov 25, 2026
Merged

asvetlov merged 1 commit into
python:mainfrom
tanloong:zoneinfo_vectorcall

Conversation

@tanloong

@tanloong tanloong commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Add @vectorcall to zoneinfo.ZoneInfo.__new__. There is no change of exception text for bad arguments.

Benchmark:

+-----------------+--------+-----------------------+
| Benchmark       | main   | patch                 |
+=================+========+=======================+
| ZoneInfo("UTC") | 112 ns | 85.0 ns: 1.32x faster |
+-----------------+--------+-----------------------+
Details
import pyperf

SETUP = """
from zoneinfo import ZoneInfo
"""

CASES = [
    ('ZoneInfo("UTC")', 'ZoneInfo("UTC")') # need `python.bat -m pip install tzdata` on Windows
]

runner = pyperf.Runner()
for name, stmt in CASES:
    runner.timeit(name, stmt=stmt, setup=SETUP)
@asvetlov
asvetlov enabled auto-merge (squash) November 25, 2026 04:42
@asvetlov
asvetlov merged commit 5982947 into python:main Nov 25, 2026
107 of 109 checks passed
@tanloong
tanloong deleted the zoneinfo_vectorcall branch November 25, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants