Changes between Initial Version and Version 3 of Ticket #35241
- Timestamp:
- Feb 22, 2024, 3:15:18 PM (9 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35241
- Property Triage Stage Unreviewed → Accepted
- Property Patch needs improvement set
-
Ticket #35241 – Description
initial v3 3 3 `Model._meta.get_parent_list()` computes the flattened list of ancestor models by MRO. This list is immutable, deterministic, and recursively constructed through the inheritance hierarchy. These properties make it a prime candidate for caching. 4 4 5 I found this method was taking ~1% of the total runtime for system checks on a project with 118 models. After adding caching, it’s reduced to a negligible amount.5 I found this method was taking ~1% (0.39ms) of the total runtime for system checks on a project with 118 models. After adding caching, it’s reduced to a negligible amount (<0.01ms). 6 6 7 7 `get_parent_list()` is called in many other code paths, so caching will help all of those too.