Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Feb 3, 2022

Conversation

sweeneyde
Copy link
Member

@sweeneyde sweeneyde commented Feb 1, 2022

@sweeneyde
Copy link
Member Author

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

@sweeneyde
Copy link
Member Author

sweeneyde commented Feb 1, 2022

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%

SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_LIST);
goto failure;
}
if (PySet_CheckExact(lhs) || PyFrozenSet_CheckExact(lhs)) {
Copy link
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
Member Author

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.

Copy link
Member

@markshannon markshannon left a comment

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.

SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_LONG_FLOAT);
goto failure;
}
#endif
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_DIFFERENT_TYPES);
Copy link
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?

SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_BASEOBJECT);
goto failure;
}
#endif
Copy link
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

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.

Python/specialize.c Outdated Show resolved Hide resolved
@markshannon
Copy link
Member

Looks good, thanks.

@markshannon markshannon merged commit 674ab66 into python:main Feb 3, 2022
@sweeneyde sweeneyde deleted the more_compare_op_stats branch February 3, 2022 18:49
Sign up for free to 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