GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-87613: Use AC vectorcall for float by cmaloney · Pull Request #158201 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Sep 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Move float.__new__ to AC vectorcall dropping the hand-written.

Running microbenchmark from the original add (pyperf timeit "float(0)" in gh-86039) shows no significant performance change.

The generated name matches the hand-written name so the tp_vectorcall slot is unchanged.

Update the vectorcall slot parity test to include float.

  • Issue: Generate vectorcall code to parse arguments using Argument Clinic #87613

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cmaloney @claude
pythongh-87613: Use the AC vectorcall for float
46140c9
Move float.__new__ to AC vectorcall dropping the hand-written.

Running microbenchmark from the original add (`pyperf timeit "float(0)"`
in pythongh-86039) shows no significant performance change.

The generated name matches the hand-written name so the tp_vectorcall
slot is unchanged.

Update the vectorcall slot-parity test to include float.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@cmaloney
cmaloney requested review from AA-Turner and erlend-aasland as code owners September 26, 2026 01:15
@cmaloney cmaloney added the skip news label Sep 26, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Sep 26, 2026
Generate vectorcall code to parse arguments using Argument Clinic #87613
Open
@bedevere-app bedevere-app Bot added the awaiting review label Sep 26, 2026
skirpichev
skirpichev approved these changes Sep 26, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Sep 26, 2026
@eendebakpt

eendebakpt commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Changes look good to me. On a local build the new code did not have a tail call, while current main did (MSVC compiler). I used Claude to let the argument clinic generate slightly easier code to compile. A godbolt link that compares main, this PR and the branch linked above: https://godbolt.org/z/5WodhW3nb

variant compiler instructions saved regs frame (bytes) tail-call to impl
main MSVC 19.4x /O2 47 3 32 yes
PR 158201 MSVC 19.4x /O2 45 4 40 yes
branch MSVC 19.4x /O2 41 3 32 yes
main GCC 15.2 -O2 34 3 0 yes
PR 158201 GCC 15.2 -O2 34 3 0 yes
branch GCC 15.2 -O2 34 3 0 yes
main Clang 20.1 -O2 36 3 0 yes
PR 158201 Clang 20.1 -O2 36 3 0 yes
branch Clang 20.1 -O2 36 3 0 yes

These changes are minor though (and compiler dependent, one could argue MSCV just needs to do a better job), so I am fine with merging this as is.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney

cmaloney commented Sep 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Appreciate the numbers. Lines up with some of what I've been finding: A lot of Argument Clinic binding performance is in compiler inlining and optimization.

I've been working on getting str, list, and int to be able to use AC Vectorcall and they are all slower because the hand written manually inlines important cases. Compilers see "two callers" + "too much complexity" and don't do the inlining most the time. AC doesn't know there is something it could inline (ex. here's how to get the global constant empty bytes for zero-arg, here's the one-arg from type A, etc.). Have some ideas on how to help AC have that information and be able to provide more type-specific overloads for the JIT as well potentially... but very prototype.

Hoping as keep iterating on AC will get some large systemic improvements. AC Vectorcall is faster when there are keyword args but often slower for positional arguments in conversions currently. When there wasn't a Vectorcall before things speedup especially if can unlock additional optimizations. Speedup depends on how much overhead the arg conversion was.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eendebakpt
eendebakpt approved these changes Oct 2, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 2, 2026
@cmaloney
Merge remote-tracking branch 'upstream/main' into pythongh-87613-float2
91f4a59
# Conflicts:
#	Objects/clinic/floatobject.c.h
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 5, 2026
@cmaloney cmaloney changed the title gh-87613: Use the AC vectorcall for float gh-87613: Use AC vectorcall for float Oct 5, 2026
@encukou
encukou merged commit 50082b8 into python:main Oct 13, 2026
88 of 98 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 13, 2026
@cmaloney
cmaloney deleted the gh-87613-float2 branch October 13, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@eendebakpt eendebakpt eendebakpt approved these changes
@skirpichev skirpichev skirpichev approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@cmaloney @eendebakpt @skirpichev @encukou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.