Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Benchmark:
importpyperffrompyperfimportRunnerclassDescr:def__init__(self,value):self.value=valuedef__get__(self,instance,owner):returnself.valueclassA:x=Descr(1)defbench(loops):a=A()t1=pyperf.perf_counter()for_inrange(loops):a.xt2=pyperf.perf_counter()returnt2-t1runner=Runner()runner.bench_time_func('descriptor',bench)
Results:
@kumaraditya303 ➜ /workspaces/cpython (main ✗) $ ./python -m pyperf compare_to base.json patch.jsonMean +- std dev: [base] 102 ns +- 6 ns -> [patch] 88.5 ns +- 4.0 ns: 1.15x faster