Skip to content

bpo-45885: Add more stats for COMPARE_OP in specialize.c - #31040

Merged
markshannon merged 4 commits into
python:mainfrom
sweeneyde:more_compare_op_stats
Feb 3, 2022
Merged

bpo-45885: Add more stats for COMPARE_OP in specialize.c#31040
markshannon merged 4 commits into
python:mainfrom
sweeneyde:more_compare_op_stats

Conversation

@sweeneyde

@sweeneydesweeneyde commented Feb 1, 2022

Copy link
Copy Markdown
Member

@sweeneyde

Copy link
Copy Markdown
MemberAuthor

Stats on some of pyperformance (before I considered float_int and int_float): https://gist.github.com/sweeneyde/157d2a24ddb7f21f2038ce1997d1b175

@sweeneyde

sweeneyde commented Feb 1, 2022

Copy link
Copy Markdown
MemberAuthor

From all of pyperformance:

COMPARE_OP_INT_JUMP: 454436174 1.9% 58.9%
COMPARE_OP: 59845807 0.2% 95.2%
COMPARE_OP_ADAPTIVE: 48912937 0.2% 96.1%
COMPARE_OP_STR_JUMP: 20343452 0.1% 98.1%
COMPARE_OP_FLOAT_JUMP: 18384022 0.1% 98.4%
COMPARE_OP:
unquickened: 59845807 10.0%
deferred: 47982034 8.0%
deopt: 5709 0.0%
hit: 492833412 82.0%
miss: 330236 0.1%
success: 110039
failure: 820864
kind 0: 50088 6.1%
kind 12: 56388 6.9%
kind 13: 45 0.0%
kind 14: 60430 7.4%
kind 15: 35732 4.4%
kind 16: 18354 2.2%
kind 17: 40646 5.0%
kind 18: 8579 1.0%
kind 19: 227608 27.7% (Note: mostly frozenset <= frozenset in bm_meteor_contest)
kind 20: 45127 5.5%
kind 21: 13893 1.7%
kind 22: 262472 32.0% (Note: mostly scimark_lu and scimark_fft doing float compared to int)
kind 23: 1502 0.2%

Comment threadPython/specialize.c Outdated
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_LIST);
goto failure;
}
if (PySet_CheckExact(lhs) || PyFrozenSet_CheckExact(lhs)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (PySet_CheckExact(lhs) ||PyFrozenSet_CheckExact(lhs)) {
if (PyAnySet_CheckExact(lhs)) {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally rather not -- IMO the || is more clear and self-explanatory.

@markshannonmarkshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The extra data is going to be useful.

Comment threadPython/specialize.c Outdated
goto failure;
}
#endif
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_DIFFERENT_TYPES);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rewrite this as SPECIALIZATION_FAIL(COMPARE_OP, compare_op_fail_kind(lhs, rhs)); following the pattern used in the other specialization functions?

Comment threadPython/specialize.c Outdated
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_BASEOBJECT);
goto failure;
}
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, could you move the classification of the failure into a helper function?
SPECIALIZATION_FAIL(COMPARE_OP, compare_op_fail_kind(lhs, rhs));
Otherwise, it obscures the logic of the specialization function.

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Comment threadPython/specialize.c Outdated
@markshannon

Copy link
Copy Markdown
Member

Looks good, thanks.

@markshannon
markshannon merged commit 674ab66 into python:mainFeb 3, 2022
@sweeneyde
sweeneyde deleted the more_compare_op_stats branch February 3, 2022 18:49
@sweeneydesweeneyde mentioned this pull request Apr 10, 2022
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

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