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
Benchmark:
import pyperf from pyperf import Runner class Descr: def __init__(self, value): self.value = value def __get__(self, instance, owner): return self.value class A: x = Descr(1) def bench(loops): a = A() t1 = pyperf.perf_counter() for _ in range(loops): a.x t2 = pyperf.perf_counter() return t2 - t1 runner = Runner() runner.bench_time_func('descriptor', bench)
Results:
@kumaraditya303 ➜ /workspaces/cpython (main ✗) $ ./python -m pyperf compare_to base.json patch.json Mean +- std dev: [base] 102 ns +- 6 ns -> [patch] 88.5 ns +- 4.0 ns: 1.15x faster
The text was updated successfully, but these errors were encountered:
GH-95977: Speed up calling pure python descriptor __get__ with vector…
f2afdf3
…call (gh-95978)
kumaraditya303
Successfully merging a pull request may close this issue.
kumaraditya303 commentedAug 14, 2022
Benchmark:
Results:
The text was updated successfully, but these errors were encountered: