Skip to content

poor scaling of descriptors in free-threading #148906

Description

@kumaraditya303

On the free-threaded build, attribute access through a user-defined __get__ descriptor scales poorly.

Reproducer

Benchmark added to Tools/ftscalingbench/ftscalingbench.py:

class MyDescriptor:
    def __get__(self, obj, objtype=None):
        return 42

    def __set__(self, obj, value):
        pass

class MyClassWithDescriptor:
    attr = MyDescriptor()

@register_benchmark
def descriptor():
    obj = MyClassWithDescriptor()
    for _ in range(1000 * WORK_SCALE):
        obj.attr

With 10 threads, Apple Silicon, free-threaded build:

descriptor          17.1x slower

Linked PRs

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions