Commit e2292d4
perf: cache JSONPriorConfig lookups
path_value_tuples re-sorted the whole flattened config on EVERY
lookup (the map was cached, the sort was not) and __call__ then
linear-scanned it, with identical queries repeating for every prior
of every model construction. Cache the sorted tuples and memoize
lookups per instance, including misses (the class-family probe in
for_class_and_suffix_path relies on repeated expected misses).
Fresh instances per config push = natural invalidation; returned
sub-dicts were already aliased across calls.
Measured on the aggregator harness: values("model") 8.15 -> 4.60
ms/result (-44%); summaries -25%. Benefits every Model construction.
Aggregator-arc deeper follow-up (#129).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 86986be commit e2292d4
2 files changed
Lines changed: 50 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
| 89 | + | |
| 90 | + | |
82 | 91 | | |
83 | 92 | | |
84 | 93 | | |
| |||
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
112 | 125 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
118 | 133 | | |
119 | 134 | | |
120 | 135 | | |
| |||
209 | 224 | | |
210 | 225 | | |
211 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
212 | 236 | | |
213 | 237 | | |
| 238 | + | |
214 | 239 | | |
| 240 | + | |
215 | 241 | | |
216 | 242 | | |
217 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments