python-attrs
attrs
BlogDocsChangelog

Replace cached_property on slotted classes with a new descriptor instead of writing `__getattr__`

#1488
Comparing
DavidCEllis:descriptor-cached-property
(
5e19f82
) with
main
(
850084d
)
CodSpeed Performance Gauge
-72%
Regressions
1
Untouched
13
New
1

Benchmarks

Failed

test_repeated_access
bench/test_benchmarks.py::TestCachedProperties
Regression
CodSpeed Performance Gauge
-72%
255 µs910.2 µs

New

test_create_cached_property_class
bench/test_benchmarks.py::TestCachedProperties
CodSpeed Performance Gauge
N/A
N/A1.1 s

Passed

test_eq_unequal
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
677 µs676.8 µs
test_create_simple_class_make_class
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
1 s1 s
test_instantiate_no_defaults
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
1.2 ms1.2 ms
test_eq_equal
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
884.7 µs884.7 µs
test_hash
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
test_instantiate_with_defaults
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
1.2 ms1.2 ms
test_create_simple_class
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
1.1 s1.1 s
test_create_frozen_class
bench/test_benchmarks.py
CodSpeed Performance Gauge
0%
1.3 s1.3 s
test_asdict_complicated
bench/test_benchmarks.py
CodSpeed Performance Gauge
-1%
9.4 ms9.4 ms
test_astuple_atomic
bench/test_benchmarks.py
CodSpeed Performance Gauge
-1%
5.7 ms5.7 ms
test_asdict_atomic
bench/test_benchmarks.py
CodSpeed Performance Gauge
-1%
6.3 ms6.3 ms
test_astuple_complicated
bench/test_benchmarks.py
CodSpeed Performance Gauge
-1%
8.7 ms8.8 ms
test_first_access
bench/test_benchmarks.py::TestCachedProperties
CodSpeed Performance Gauge
-1%
6.4 ms6.5 ms

Commits

Click on a commit to change the comparison range
Base
main
850084d
-0.04%
discrepancy
ea11e00
3 days ago
by DavidCEllis
-76.16%
Merge branch 'main' into descriptor-cached-property
f0a7887
1 day ago
by hynek
+4.22%
Try caching the get, set and delete methods for the slot.
921174e
1 day ago
by DavidCEllis
-0.01%
Add a benchmark for constructing classes with cached properties
65b5b35
21 hours ago
by DavidCEllis
+0.01%
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
5e19f82
21 hours ago
by pre-commit-ci[bot]
© 2025 CodSpeed Technology
Home Terms Privacy Docs