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-115775: Use `__static_attributes__` to initialize shared keys by markshannon · Pull Request #118468 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented May 1, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Use static analysis to assist inlining values and compact object layout. #115775

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot mentioned this pull request May 1, 2024
Use static analysis to assist inlining values and compact object layout. #115775
Open
@markshannon

markshannon commented May 1, 2024

Copy link
Copy Markdown
Member Author

No need for news item as it is covered by #117909

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon markshannon added the skip news label May 1, 2024
@markshannon
markshannon force-pushed the use-attributes-to-guide-inline-values-size branch from dedffa7 to 5032ad9 Compare May 1, 2024 13:56
@markshannon
markshannon marked this pull request as ready for review May 1, 2024 20:38
@markshannon
markshannon requested a review from methane as a code owner May 1, 2024 20:38
@bedevere-app bedevere-app Bot added the awaiting core review label May 1, 2024
@markshannon
markshannon force-pushed the use-attributes-to-guide-inline-values-size branch from 846a7ef to a7b858b Compare May 2, 2024 10:47
carljm
carljm approved these changes May 2, 2024
View reviewed changes
Comment thread Python/specialize.c Resolved

Uh oh!

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

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels May 2, 2024
markshannon added 2 commits May 3, 2024 19:29
@markshannon
Use __static_attributes__ to initialize shared keys
94bf898
@markshannon
Initialize value
d54afaf
@markshannon
markshannon force-pushed the use-attributes-to-guide-inline-values-size branch from b64de3d to d54afaf Compare May 3, 2024 18:30
@markshannon

markshannon commented May 3, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

The stats are not obviously better.

This PR reduces misses in LOAD_ATTR specializations, but it also increases the number of deferred operations due to shadowing.

Both STORE_ATTR_WITH_HINT and LOAD_ATTR_WITH_HINT are reduced in number considerably, being replaced by STORE_ATTR_INSTANCE_VALUE and LOAD_ATTR_INSTANCE_VALUE.

From this, it appears that this PR does what it aims to do. It also appears that it would be worth improving our handling of shadowed attributes.

I plan to fix the shadowing issue before merging this, so that it becomes a clear improvement

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon
Merge branch 'main' into use-attributes-to-guide-inline-values-size
3d7e23f
methane
methane approved these changes Aug 6, 2024
View reviewed changes
@markshannon
Merge branch 'main' into use-attributes-to-guide-inline-values-size
bb3ea59
@markshannon

markshannon commented Aug 23, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

Now that #123040 is fixed things look much better.

Performance shows no change apart from the "go" benchmark speeds up by 35%. The "go" benchmark creates many objects before initializing them, which is a pattern that this PR allows us to optimize.

The stats show a small increase in specialization of LOAD_ATTR with a 95% reduction of "not in dict" specialization failure. Almost certainly most of that is from the "go" benchmark.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon
markshannon merged commit 89328f7 into python:main Aug 27, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Aug 27, 2024
@markshannon
markshannon deleted the use-attributes-to-guide-inline-values-size branch August 27, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@carljm carljm carljm approved these changes
@methane methane methane approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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

@markshannon @carljm @methane
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.