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-46841: Improve the failure stats for `COMPARE_OP` by brandtbucher · Pull Request #31663 · python/cpython

Conversation

@brandtbucher

@brandtbucher brandtbucher commented Mar 3, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

With the move to inline caching, jumps are getting a bit longer. This adds new category of COMPARE_OP failures for the (increasingly more common) case where a COMPARE_OP instruction is followed by an EXTENDED_ARG.

New stats for a full pyperformance run:

Kind Count Ratio
unquickened 7348739 0.4%
specialization.deferred 359371048 21.7%
specialization.deopt 15730 0.0%
hit 1289210975 77.8%
miss 943057 0.1%

Specialization attempts

Count Ratio
Success 289083 4.8%
Failure 5723386 95.2%
Failure kind Count Ratio
extended arg 2473174 43.2%
not followed by cond jump 1258612 22.0%
float long 671682 11.7%
set 579241 10.1%
different types 165539 2.9%
bool 137038 2.4%
tuple 119632 2.1%
other 115566 2.0%
big int 95547 1.7%
bytes 46481 0.8%
baseobject 37335 0.7%
list 22634 0.4%
string 704 0.0%
long float 201 0.0%

https://bugs.python.org/issue46841

Sorry, something went wrong.

Uh oh!

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

All reactions
brandtbucher added 2 commits March 3, 2022 10:44
@brandtbucher
Improve the failure stats for COMPARE_OP
3c2c673
@brandtbucher
blurb add
1036d0d
@brandtbucher
brandtbucher requested review from markshannon and sweeneyde March 3, 2022 18:55
@bedevere-bot bedevere-bot added the awaiting core review label Mar 3, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 3, 2022
sweeneyde
sweeneyde approved these changes Mar 3, 2022
View reviewed changes

@sweeneyde sweeneyde left a comment •
edited
Loading

Uh oh!

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

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 good.

We could also consider packing extended opargs into the top 13 bits of cache->mask when it fits there.

Edit: I suppose it would be difficult to do next_instr++ the correct number of times in ceval. Store how far to jump ahead for that branch as well?

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Mar 3, 2022
@brandtbucher brandtbucher mentioned this pull request Mar 3, 2022
Inline caching faster-cpython/ideas#310
Closed
21 of 26 tasks
@brandtbucher

brandtbucher commented Mar 3, 2022

Copy link
Copy Markdown
Member Author

@markshannon is already brainstorming ideas for how to tackle the general problem of longer jumps in faster-cpython/ideas#297 and faster-cpython/ideas#301. We should probably wait to see how that pans out first before adding a bunch of new logic to the different COMPARE_OP specializations.

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher
brandtbucher merged commit 127797f into python:main Mar 3, 2022
@bedevere-bot bedevere-bot removed the awaiting merge label Mar 3, 2022
@markshannon

markshannon commented Mar 3, 2022

Copy link
Copy Markdown
Member

Feel free to add suggestions to faster-cpython/ideas#301.

faster-cpython/ideas#297 is more about giving the bytecode compiler freedom to lay out basic blocks.

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher brandtbucher mentioned this pull request Apr 10, 2022
Inline bytecode caches #90997
Closed
@brandtbucher
brandtbucher deleted the more-compare-op-stats branch July 21, 2022 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sweeneyde sweeneyde sweeneyde approved these changes
@markshannon markshannon Awaiting requested review from markshannon

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.

5 participants

@brandtbucher @markshannon @sweeneyde @the-knights-who-say-ni @bedevere-bot
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.