Commit b13ddd4
committed
cty: Use WrangleMarksDeep for UnmarkDeep and UnmarkDeepWithPaths
These functions were previously using the "Transformer" mechanism, which is
very general but as a result ends up always conservatively rebuilding
the entire data structure it's given.
The recently-added WrangleMarksDeep relies on the fact that it can only
possibly change marks (not the actual values) to avoid building a new
value at all in the common case where there are no marks, to rebuild
only the parts of the structure that have mark changes when changes are
being made, and to reuse the internal "payload" values from the source
values while just wrapping them in a new outer cty.Value.
Testing with a benchmark in another codebase that makes heavy use of both
UnmarkDeep and UnmarkDeepWithPaths shows this being a material performance
improvement.
This also includes a bonus fast path for MarkWithPaths where it will skip
doing anything at all if the given slice of ParkValueMarks is empty.1 parent 4453ac2 commit b13ddd4
2 files changed
+33
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
287 | 294 | | |
288 | 295 | | |
289 | 296 | | |
| |||
305 | 312 | | |
306 | 313 | | |
307 | 314 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | 315 | | |
327 | 316 | | |
328 | 317 | | |
329 | 318 | | |
330 | 319 | | |
331 | 320 | | |
332 | 321 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
344 | 328 | | |
345 | 329 | | |
346 | 330 | | |
347 | 331 | | |
348 | 332 | | |
349 | 333 | | |
350 | 334 | | |
351 | | - | |
352 | | - | |
353 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
354 | 353 | | |
355 | 354 | | |
356 | 355 | | |
| |||
0 commit comments