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:
Linked PRs
On the free-threaded build, attribute access through a user-defined
__get__descriptor scales poorly.Reproducer
Benchmark added to
Tools/ftscalingbench/ftscalingbench.py:With 10 threads, Apple Silicon, free-threaded build:
descriptor 17.1x slowerLinked PRs