Repository navigation
Commit adad560
committed
Only allocate coerced fields once something actually changes
`coerce_fields_by_name` rebuilt every file field into a new `Fields` even
when no coercion applied, which cost an allocation and a reference count
bump per field for schemas that need no coercion at all.
Build the output lazily instead: the fields before the first change are
copied over when that change happens, and schemas that need no coercion
are walked without allocating or touching the file fields' reference
counts. The same helper is now used for map entries, so the laziness
applies at every nesting level rather than only at the top as the
previous `needs_*` pre-scan did.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PL624RiDwff7RVJ2BKSvS51 parent 2a6cbd0 commit adad560
1 file changed
Lines changed: 39 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
99 | 120 | | |
100 | | - | |
101 | | - | |
102 | 121 | | |
103 | | - | |
104 | | - | |
| 122 | + | |
| 123 | + | |
105 | 124 | | |
106 | | - | |
| 125 | + | |
107 | 126 | | |
108 | 127 | | |
109 | 128 | | |
| |||
175 | 194 | | |
176 | 195 | | |
177 | 196 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
192 | 200 | | |
193 | | - | |
| 201 | + | |
194 | 202 | | |
195 | 203 | | |
196 | 204 | | |
| |||
0 commit comments