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-100288: Specialize class attribute loads by brandtbucher · Pull Request #101379 · python/cpython

Conversation

@brandtbucher

@brandtbucher brandtbucher commented Jan 27, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This handles all of the "class attr simple" failures.

Benchmarking results are "1.00x faster". It improves the LOAD_ATTR hit rate by less than 1%, and has a 32% miss rate (I suspect, due to polymorphism).

  • Issue: Finish up LOAD_ATTR specialisation #100288

Sorry, something went wrong.

Uh oh!

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

All reactions
@brandtbucher
Add LOAD_ATTR_CLASS_FROM_INSTANCE
8b346a3
@brandtbucher brandtbucher added performance Performance or resource usage interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jan 27, 2023
@brandtbucher
brandtbucher requested review from Fidget-Spinner and markshannon January 27, 2023 18:03
@brandtbucher brandtbucher self-assigned this Jan 27, 2023
@bedevere-bot bedevere-bot added the awaiting core review label Jan 27, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jan 27, 2023
Finish up LOAD_ATTR specialisation #100288
Closed
1 of 2 tasks
@Fidget-Spinner Fidget-Spinner added the DO-NOT-MERGE label Jan 27, 2023
@markshannon

markshannon commented Jan 29, 2023

Copy link
Copy Markdown
Member

If this addresses the "class attr simple" case, then according to the stats it should improve the hit rate by 4-5% (13.3% * 0.36).
So, something isn't right there. Are the stats right?

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher

brandtbucher commented Jan 31, 2023

Copy link
Copy Markdown
Member Author

So, something isn't right there. Are the stats right?

I assume so. Here are the stats for the base commit and this branch.

For LOAD_ATTR, deferreds fell by 1.3%, hits rose by 0.7%, and misses rose by 0.6%.

I'm guessing that there are two reasons why the number of hits didn't increase by the full 5% you're expecting:

  • About 1/3 of the new instructions that do specialize end up missing (so we should really be expecting a ~3% increase in hits).
  • More importantly, it looks like nearly all of the cases that used to fail with "class attr simple" are now failing with "has managed dict" (line 860 in this PR). You can see that, before, we had ~600k each of "class attr simple" and "has managed dict" failures. Now, we have 0 "class attr simple" failures, and 1.1M "has managed dict" failures.

So, it appears that "class attr simple" is not so "simple" after all... 5 out of 6 instances that reach it have a __dict__!

All reactions

Sorry, something went wrong.

Uh oh!

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

@gvanrossum

gvanrossum commented Feb 5, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

When (if?) you fix the merge conflict, could you add those new opcodes to the LOAD_ATTR family and properly declare their cache/stack effects, letting the generator take care of those? I recently modernized all the existing family members (gh-101488).

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher brandtbucher closed this Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner

Uh oh!

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

Assignees

@brandtbucher brandtbucher

Labels

awaiting core review DO-NOT-MERGE interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

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

@brandtbucher @markshannon @gvanrossum @bedevere-bot @Fidget-Spinner
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.