Overview
Follow-up authorized off the aggregator profiling arc (PyAutoFit#1375/#1385): the recorded "deeper, not low-hanging" target. cProfile of values("samples_summary") over 100 mock results (12ms/result): 77% is the model load, and most of that is Model.__init__ building default priors from prior config — JSONPriorConfig.path_value_tuples re-sorts the entire flattened config dict on every lookup (the flattened map is cached, the sort is not), and __call__ then linear-scans it, with identical (class, attribute) queries repeating for every prior of every result.
Plan
autoconf/json_prior/config.py: cache the sorted path_value_tuples on the instance; memoize __call__ and for_class_and_suffix_path per instance (positive results and KeyError misses — the class-family probe relies on expected misses). Instance-level caches are invalidated naturally: config pushes construct fresh JSONPriorConfig instances, and returned sub-dicts were already aliased across calls today, so no new sharing is introduced.
- Measure with the merged aggregator harness (summary/model stages, before/after) + cProfile.
- Suites: autoconf + full PyAutoFit (prior config is load-bearing everywhere).
Worktree: ~/Code/PyAutoLabs-wt/prior-config-cache/ · Branch: feature/prior-config-cache · Repos: PyAutoConf (only; autofit_workspace_test used read-only for measurement).
Overview
Follow-up authorized off the aggregator profiling arc (PyAutoFit#1375/#1385): the recorded "deeper, not low-hanging" target. cProfile of
values("samples_summary")over 100 mock results (12ms/result): 77% is themodelload, and most of that isModel.__init__building default priors from prior config —JSONPriorConfig.path_value_tuplesre-sorts the entire flattened config dict on every lookup (the flattened map is cached, the sort is not), and__call__then linear-scans it, with identical(class, attribute)queries repeating for every prior of every result.Plan
autoconf/json_prior/config.py: cache the sortedpath_value_tupleson the instance; memoize__call__andfor_class_and_suffix_pathper instance (positive results and KeyError misses — the class-family probe relies on expected misses). Instance-level caches are invalidated naturally: config pushes construct freshJSONPriorConfiginstances, and returned sub-dicts were already aliased across calls today, so no new sharing is introduced.Worktree:
~/Code/PyAutoLabs-wt/prior-config-cache/· Branch:feature/prior-config-cache· Repos: PyAutoConf (only; autofit_workspace_test used read-only for measurement).