perf: decompress already-cached files concurrently with downloads#36423
Open
perf: decompress already-cached files concurrently with downloads#36423
Conversation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
PR summary a182019be7Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
When forceDownload=true, downloadFiles re-downloads all files including already-cached ones, so the background decompression task would race with the download pipeline on the same files. Disable background decompression in this case and let the pipeline + final sweep handle it. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Extract `mkLeanTarConfig` as a shared helper for building the leantar JSON config, eliminating duplication between `prepareDecompConfig` and `unpackCache`. Replace the anonymous `(Array Lean.Json × Nat × Nat)` triple with a `DecompPlan` structure with named fields. Co-Authored-By: Claude Opus 4.6 <[email protected]>
joneugster
reviewed
Mar 29, 2026
| else | ||
| IO.println s!"Decompressing {plan.needsDecomp} already-cached file(s)" | ||
| let now ← IO.monoMsNow | ||
| let task ← IO.asTask (IO.spawnLeanTarDecompress plan.config forceUnpack) |
Contributor
There was a problem hiding this comment.
this starts a task even if there is nothing to do, doesn't it?
Contributor
Author
There was a problem hiding this comment.
prepareDecompConfig returns none when there are no cached files needing decompression (it checks cached.isEmpty and toDecomp.isEmpty before returning some), so the if let some plan on the line above ensures we only reach this point when there's actual work to do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR builds on #32987 (pipeline downloads and decompression) and #36367 (fix: decompress already downloaded files).
Previously, already-cached
.ltarfiles were only decompressed after all downloads completed, in the finalunpackCachesweep. This PR starts decompressing them concurrently with downloads by spawningleantaras a background task before the download phase begins.The two decompression paths operate on disjoint file sets (pre-cached vs newly downloaded), so there is no conflict. In the common case where a user has most files cached but a few hundred to download, this overlaps several seconds of decompression with network I/O.
🤖 Prepared with Claude Code