Skip to content

Conversation

@brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commented Mar 3, 2022

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:

KindCountRatio
unquickened73487390.4%
specialization.deferred35937104821.7%
specialization.deopt157300.0%
hit128921097577.8%
miss9430570.1%

Specialization attempts

CountRatio
Success2890834.8%
Failure572338695.2%
Failure kindCountRatio
extended arg247317443.2%
not followed by cond jump125861222.0%
float long67168211.7%
set57924110.1%
different types1655392.9%
bool1370382.4%
tuple1196322.1%
other1155662.0%
big int955471.7%
bytes464810.8%
baseobject373350.7%
list226340.4%
string7040.0%
long float2010.0%

https://bugs.python.org/issue46841

Copy link
Member

@sweeneydesweeneyde left a 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?

@brandtbucher
Copy link
MemberAuthor

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

@brandtbucherbrandtbucher merged commit 127797f into python:mainMar 3, 2022
@markshannon
Copy link
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.

@brandtbucherbrandtbucher mentioned this pull request Apr 10, 2022
@brandtbucherbrandtbucher deleted the more-compare-op-stats branch July 21, 2022 19:53
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@brandtbucher@markshannon@sweeneyde@the-knights-who-say-ni@bedevere-bot