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-126868: Add freelist for compact ints to _PyLong_New by eendebakpt · Pull Request #128181 · python/cpython

Conversation

@eendebakpt

@eendebakpt eendebakpt commented Dec 22, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

We add freelist support to _PyLong_New (this was missed/left out in #126868). On the pyperformance suite this increases the percentage of allocations from freelist by roughly 1%. For comparison, the addition of the freelist to _PyLong_FromMedium increased the percentage by roughly 20%. Also note that _PyLong_New is used in the new PyLongWriter_Create (see https://peps.python.org/pep-0757/), so usage with external packages might be a bit higher.

Microbenchmark:

import pyperf

def bench_lshift(loops):
    range_it = range(loops)
    t0 = pyperf.perf_counter()
    for ii in range_it:
        _ = ii << 2
    return pyperf.perf_counter() - t0

if __name__ == "__main__":
    runner = pyperf.Runner()
    runner.bench_time_func("bench_lshift", bench_lshift)

results in:

Mean +- std dev: [main] 44.7 ns +- 3.0 ns -> [pr] 40.9 ns +- 2.3 ns: 1.09x faster
  • Issue: Add freelist for compact int objects #126868

Sorry, something went wrong.

Uh oh!

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

All reactions
@eendebakpt
add freelist to _pylong_new
3c3eddc
@bedevere-app bedevere-app Bot added the awaiting review label Dec 22, 2024
eendebakpt added 2 commits December 22, 2024 16:41
@eendebakpt
add check for no-gil build
a912b8f
@eendebakpt
revert accidental change
91acd01
@eendebakpt eendebakpt changed the title gh-26868: Add freelist for compact ints to _PyLong_New gh-126868: Add freelist for compact ints to _PyLong_New Dec 22, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Dec 22, 2024
Add freelist for compact int objects #126868
Closed
@blurb-it
📜🤖 Added by blurb_it.
4dda501
kumaraditya303
kumaraditya303 reviewed Dec 26, 2024
View reviewed changes
Comment thread Objects/longobject.c Resolved

Uh oh!

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

@kumaraditya303
Update Objects/longobject.c
f1ddf85
kumaraditya303
kumaraditya303 approved these changes Dec 26, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Dec 26, 2024
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) December 26, 2024 14:48
@kumaraditya303
kumaraditya303 merged commit 3bd7730 into python:main Dec 26, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Dec 26, 2024
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
@eendebakpt @kumaraditya303 @srinivasreddy
pythongh-126868: Add freelist for compact ints to _PyLong_New (pyth…
4c51a09
…on#128181)

Co-authored-by: Kumar Aditya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

2 participants

@eendebakpt @kumaraditya303
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.