Files
Samuel Karp e6ca378dcf archive: skip redundant opaque whiteout walks
When unpacking a layer changeset in applyNaive, encountering an opaque
whiteout (.wh..wh..opq) triggers a directory walk to remove files
belonging to lower layers. Since files unpacked earlier in the current
layer are recorded in unpackedPaths and preserved, interleaved files and
opaque whiteouts in the same directory cause repeated walks over the
same growing directory, leading to superlinear execution time.

Once a directory has been purged of lower-layer files by an opaque
whiteout, all existing and subsequent entries in that directory are
guaranteed to be in unpackedPaths. Tracking directories that have
already processed an opaque whiteout allows subsequent opaque whiteouts
for the same directory to return early, restoring linear unpack time.

Benchmark results (n=1,000):

| Metric | Pre-change | Post-change | Delta |
| :--- | :--- | :--- | :--- |
| Execution Time | 2,578.8 ms/op | 135.3 ms/op | ~19.1x faster (94.8% reduction) |
| Allocated Memory | 200.5 MB/op | 2.3 MB/op | ~86.9x less memory (98.8% reduction) |
| Allocs / op | 2,068,820 allocs/op | 48,060 allocs/op | ~43.0x fewer allocs (97.7% reduction) |

Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-08-28 14:50:34 -07:00
..
2026-03-15 18:24:15 +01:00
2026-03-15 18:24:15 +01:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00
2024-01-17 09:54:18 -08:00