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 and AC vectorcall for bool by cmaloney · Pull Request #160791 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Oct 28, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Move bool.__new__ to Argument Clinic with @vectorcall, dropping the hand-written bool_new and bool_vectorcall. The generated vectorcall name matches the hand-written one so the tp_vectorcall slot is unchanged, and argument error messages are unchanged on both paths.

pyperf microbenchmark (PGO+LTO, run serially), no significant change on the vectorcall path:

Benchmark base bool
bool.__new__ 23.0 ns 21.7 ns: 1.06x faster
bool() 10.1 ns 10.4 ns: 1.03x slower
bool(int) 12.2 ns 12.6 ns: 1.03x slower
bool(True) 11.1 ns 11.4 ns: 1.03x slower
Geometric mean (ref) 1.00x slower

Benchmark hidden because not significant (2): bool(bool), bool(list)

Instructions per call (callgrind, inclusive of bool_vectorcall or bool_new, PGO+LTO):

Case base bool delta
bool() 17 18 +1
bool(True) 20 23 +3
bool(12345) 53 49 -4
bool([1]) 50 47 -3
bool.__new__(bool, 1) 127 69 -58
  • 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 AC vectorcall for bool
5e41a26
Move bool.__new__ to Argument Clinic with @vectorcall, dropping the
hand-written bool_new and bool_vectorcall. The generated vectorcall name
matches the hand-written one so the tp_vectorcall slot is unchanged, and
argument error messages are unchanged on both paths.

pyperf microbenchmark (PGO+LTO, run serially), no significant change on
the vectorcall path:

| Benchmark      | base    | bool                  |
|----------------|:-------:|:---------------------:|
| bool.__new__   | 23.0 ns | 21.7 ns: 1.06x faster |
| bool()         | 10.1 ns | 10.4 ns: 1.03x slower |
| bool(int)      | 12.2 ns | 12.6 ns: 1.03x slower |
| bool(True)     | 11.1 ns | 11.4 ns: 1.03x slower |
| Geometric mean | (ref)   | 1.00x slower          |

Benchmark hidden because not significant (2): bool(__bool__), bool(list)

Instructions per call (callgrind, inclusive of bool_vectorcall or
bool_new, PGO+LTO):

| Case                  | base | bool | delta |
|-----------------------|-----:|-----:|------:|
| bool()                |   17 |   18 |    +1 |
| bool(True)            |   20 |   23 |    +3 |
| bool(12345)           |   53 |   49 |    -4 |
| bool([1])             |   50 |   47 |    -3 |
| bool.__new__(bool, 1) |  127 |   69 |   -58 |

The compiler folds PyObject_IsTrue(Py_False) for bool(), so the default
costs nothing; the small deltas are register allocation. bool.__new__
drops PyArg_UnpackTuple for inline clinic parsing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bedevere-app bedevere-app Bot added awaiting review type-feature A feature request or enhancement labels Oct 28, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 28, 2026
Generate vectorcall code to parse arguments using Argument Clinic #87613
Open
@cmaloney cmaloney added the skip news label Oct 28, 2026
@cmaloney cmaloney changed the title gh-87613: Use AC vectorcall for bool gh-87613: Use AC and AC vectorcall for bool Oct 28, 2026
msullivan
msullivan approved these changes Oct 28, 2026
View reviewed changes

@msullivan msullivan left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nice cleanup

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Oct 28, 2026
eendebakpt
eendebakpt approved these changes Oct 28, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 28, 2026
@eendebakpt
eendebakpt merged commit a7c0383 into python:main Nov 1, 2026
61 of 67 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 1, 2026
@cmaloney
cmaloney deleted the ac_vc_bool branch November 1, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@msullivan msullivan msullivan approved these changes
@eendebakpt eendebakpt eendebakpt approved these changes

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.

3 participants

@cmaloney @msullivan @eendebakpt
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.