-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
gh-92810: Reduce memory usage by ABCMeta.__subclasscheck__ #131914
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
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
3 similar comments
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Signed-off-by: Martynov Maxim <martinov_m_s_@mail.ru>
Signed-off-by: Martynov Maxim <martinov_m_s_@mail.ru>
Signed-off-by: Martynov Maxim <martinov_m_s_@mail.ru>
Signed-off-by: Martynov Maxim <martinov_m_s_@mail.ru>
Signed-off-by: Martynov Maxim <martinov_m_s_@mail.ru>
abf4bfe
to
b7603e0
Compare
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Do you happen to know this will play with #119719? |
@picnixz Could you please take a look on this PR? |
Misc/NEWS.d/next/Core_and_Builtins/2025-06-13-17-22-34.gh-issue-92810.Tb6x6C.rst
Outdated
Show resolved
Hide resolved
Did the improvements in |
This is because in real applications I can add both cases to benchmark, if required. |
Yes, please add both benchmarks. |
Added scripts and microbenchmark results to PR description |
_abc._abc_subclasscheck
has very poor performance and (I think) a memory leak #92810For python build using
--enable-optimizations
:test_performance_abc_isinstance.py
test_performance_abc_issubclass.py
For 8k nested subclasses:
isinstance(cached class, parent)
isinstance(cached class, sibling)
isinstance(cached class, grandparent)
isinstance(cached class, cousin)
isinstance(cached class, parent via .register())
isinstance(cached class, sibling via .register())
isinstance(cached class, grandparent via .register())
isinstance(cached class, cousin via .register())
isinstance(cached class, parent via __subclasses__)
isinstance(cached class, sibling via __subclasses__)
isinstance(cached class, grandparent via __subclasses__)
isinstance(cached class, cousin via __subclasses__)
isinstance(new class, parent)
isinstance(new class, sibling)
isinstance(new class, grandparent)
isinstance(new class, cousin)
isinstance(new class, parent via .register())
isinstance(new class, sibling via .register())
isinstance(new class, grandparent via .register())
isinstance(new class, cousin via .register())
isinstance(new class, parent via __subclasses__)
isinstance(new class, sibling via __subclasses__)
isinstance(new class, grandparent via __subclasses__)
isinstance(new class, cousin via __subclasses__)
issubclass(cached class, parent)
issubclass(cached class, sibling)
issubclass(cached class, grandparent)
issubclass(cached class, cousin)
issubclass(cached class, parent via .register())
issubclass(cached class, sibling via .register())
issubclass(cached class, grandparent via .register())
issubclass(cached class, cousin via .register())
issubclass(cached class, parent via __subclasses__)
issubclass(cached class, sibling via __subclasses__)
issubclass(cached class, grandparent via __subclasses__)
issubclass(cached class, cousin via __subclasses__)
issubclass(new class, parent)
issubclass(new class, sibling)
issubclass(new class, grandparent)
issubclass(new class, cousin)
issubclass(new class, parent via .register())
issubclass(new class, sibling via .register())
issubclass(new class, grandparent via .register())
issubclass(new class, cousin via .register())
issubclass(new class, parent via __subclasses__)
issubclass(new class, sibling via __subclasses__)
issubclass(new class, grandparent via __subclasses__)
issubclass(new class, cousin via __subclasses__)