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 — bpo-37029: keep usable_arenas in sorted order without searching by tim-one · Pull Request #13612 · python/cpython

Conversation

@tim-one

@tim-one tim-one commented May 28, 2019 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This adds a vector of "search fingers" so that usable_arenas can be kept in sorted order (by number of free pools) via constant-time operations instead of linear search.

This should reduce worst-case time for reclaiming a great many objects from O(A**2) to O(A), where A is the number of arenas.

https://bugs.python.org/issue37029

Sorry, something went wrong.

Uh oh!

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

All reactions
@tim-one
Issue 37029: first stab at removing all searching to keep usable_arenas
c691a69
sorted by number of free pools.
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 28, 2019
@bedevere-bot bedevere-bot added the awaiting core review label May 28, 2019
@tim-one tim-one self-assigned this May 28, 2019
blurb-it Bot and others added 4 commits May 28, 2019 17:02
@blurb-it
📜🤖 Added by blurb_it.
f4a60e8
@tim-one
Beefed up an assert; added the BPO number to a comment.
efe1e63
@tim-one
Merge branch 'remove-arena-search' of https://github.com/tim-one/cpython
0b36d42
 into remove-arena-search
@tim-one
And added one more assert.
0463a7d
methane
methane reviewed May 29, 2019
View reviewed changes
Comment thread Objects/obmalloc.c Resolved

Uh oh!

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

methane
methane approved these changes May 31, 2019
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels May 31, 2019
pitrou
pitrou reviewed May 31, 2019
View reviewed changes

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

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.

Looks neat, just a comment.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Objects/obmalloc.c
@@ -1172,6 +1189,9 @@ static struct arena_object* unused_arena_objects = NULL;
*/

@pitrou pitrou May 31, 2019

Copy link
Copy Markdown
Member

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.

Add comment documenting that they are sorted in number of free pools?

Sorry, something went wrong.

Uh oh!

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

All reactions

@tim-one tim-one May 31, 2019

Copy link
Copy Markdown
Member Author

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.

I'd rather not, unless you feel strongly about it. This has been documented all along, but up where the main explanation of arenas lives (look at the comment block about usable_arenas at line 1150).

There are a bunch of moving parts here, and the style of the file is to give long-ish English explanations in uninterrupted comment blocks, with only the briefest of memory-jogging comments on declaration lines.

Sorry, something went wrong.

Uh oh!

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

All reactions
@tim-one
tim-one merged commit 1c263e3 into python:master Jun 1, 2019
@bedevere-bot

bedevere-bot commented Jun 1, 2019

Copy link
Copy Markdown

@tim-one: Please replace # with GH- in the commit message next time. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting merge label Jun 1, 2019
@tim-one
tim-one deleted the remove-arena-search branch June 1, 2019 02:30
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
@tim-one @DinoV
bpo-37029: keep usable_arenas in sorted order without searching (pyth…
239f688
…on#13612)

This adds a vector of "search fingers" so that usable_arenas can be kept in sorted order (by number of free pools) via constant-time operations instead of linear search.

This should reduce worst-case time for reclaiming a great many objects from O(A**2) to O(A), where A is the number of arenas.  See bpo-37029.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pitrou pitrou pitrou left review comments
@methane methane methane approved these changes

Uh oh!

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

Assignees

@tim-one tim-one

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.

5 participants

@tim-one @bedevere-bot @methane @pitrou @the-knights-who-say-ni
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.