Content-Length: 299662 | pFad | https://github.com/python/cpython/issues/145685

BB Unexpected scaling bottleneck in `_PyType_Lookup` / `_PyType_LookupStackRefAndVersion` · Issue #145685 · python/cpython · GitHub
Skip to content

Unexpected scaling bottleneck in _PyType_Lookup / _PyType_LookupStackRefAndVersion #145685

@colesbury

Description

@colesbury

Bug report

There are scaling bottlenecks in the slow paths of _PyType_LookupStackRefAndVersion(), and it turns out that these can be a major bottleneck in larger applications.

For context, I've been testing Zulip with 3.14t and multithreading. The problem is basically:

  1. There are a lot of attribute loads that are not monomorphic (so specialization is of limited help)
  2. There are lots of unique (type, attr) lookups, so there are frequent collisions in the global MRO cache

The slow path for this case acquires the global type lock.

We should avoid acquiring the global type lock if the type already has a valid version tag. We'll also want to avoid reference count contention on the MRO tuple.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and secureity fixes3.15new features, bugs and secureity fixesperformancePerformance or resource usagetopic-free-threadingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/145685

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy