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

Too many specialization attempts when we are never going to succeed. #93354

Closed
markshannon opened this issue May 30, 2022 · 0 comments
Closed
Labels
3.11 only security fixes 3.12 only security fixes performance Performance or resource usage type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

There are quite a few (value, operation) pairs that we cannot specialize.
For those operations, we can spend a significant amount of time repeatedly attempting to specialize, and repeatedly failing.

There is a well known fix for this, which is "exponential backoff".
The idea is that each time you fail to specialize (or otherwise fail to optimize) the countdown counter is set to twice its previous starting value.
Currently, we attempt to specialize every 64 executions, with exponential backoff we would start at 31, then 63, then 127 until we reach a limit of 4095 for a 12 bit counter and 4 bit backoff exponent.

See faster-cpython/ideas#397 for more details

@markshannon markshannon added the type-bug An unexpected behavior, bug, or error label May 30, 2022
@AA-Turner AA-Turner added performance Performance or resource usage 3.12 only security fixes labels May 30, 2022
@markshannon markshannon added the 3.11 only security fixes label May 31, 2022
markshannon added a commit that referenced this issue May 31, 2022
…ation attempts. (GH-93355)

(cherry picked from commit eb618d5)

Co-authored-by: Mark Shannon <mark@hotpy.org>
ambv added a commit that referenced this issue Jun 30, 2022
…ation attempts (GH-93355) (GH-93379)

Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 only security fixes performance Performance or resource usage type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants