Including 3 opcodes: COMPARE_OP_INT and COMPARE_OP_FLOAT and COMPARE_OP_STR (equality only) seems to give pretty good specialization numbers, better than just 2.
Most comparisons are followed by a jump, and much of the overhead is in the branching around the choice of operator as well as pushing and popping (with inc/decrefs) a value that has only one bit of information (True/False).
Activity
sweeneyde commented on Nov 23, 2021
Some specialization statistics:
https://gist.github.com/sweeneyde/49cc3a9d074d56cf095cb0a42d13d7a4
Including 3 opcodes: COMPARE_OP_INT and COMPARE_OP_FLOAT and COMPARE_OP_STR (equality only) seems to give pretty good specialization numbers, better than just 2.
markshannon commented on Nov 24, 2021
Is COMPARE_OP worth specializing by itself?
Most comparisons are followed by a jump, and much of the overhead is in the branching around the choice of operator as well as pushing and popping (with inc/decrefs) a value that has only one bit of information (True/False).
markshannon commented on Dec 3, 2021
New changeset 03768c4 by Dennis Sweeney in branch 'main':
bpo-45885: Specialize COMPARE_OP (GH-29734)
03768c4
markshannon commented on Feb 3, 2022
New changeset 674ab66 by Dennis Sweeney in branch 'main':
bpo-45885: Add more stats for COMPARE_OP in specialize.c (GH-31040)
674ab66
markshannon commented on Feb 23, 2022
New changeset 375a56b by Brandt Bucher in branch 'main':
bpo-45885: Don't un-adapt COMPARE_OP when collecting stats (GH-31516)
375a56b
GH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)
Merge branch 'main' into fastmock
Merge remote-tracking branch 'origin/main' into bpo_34697