Skip to content

perf: decompress already-cached files concurrently with downloads#36423

Open
kim-em wants to merge 3 commits intomasterfrom
perf/cache-decompress-cached-early
Open

perf: decompress already-cached files concurrently with downloads#36423
kim-em wants to merge 3 commits intomasterfrom
perf/cache-decompress-cached-early

Conversation

@kim-em
Copy link
Copy Markdown
Contributor

@kim-em kim-em commented Mar 10, 2026

This PR builds on #32987 (pipeline downloads and decompression) and #36367 (fix: decompress already downloaded files).

Previously, already-cached .ltar files were only decompressed after all downloads completed, in the final unpackCache sweep. This PR starts decompressing them concurrently with downloads by spawning leantar as 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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 10, 2026

PR summary a182019be7

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ DecompPlan
+ mkLeanTarConfig
+ prepareDecompConfig

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

kim-em and others added 2 commits March 10, 2026 03:57
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]>
@grunweg grunweg added the LLM-generated PRs with substantial input from LLMs - review accordingly label Mar 16, 2026
@bryangingechen bryangingechen assigned joneugster and unassigned urkud Mar 26, 2026
@joneugster joneugster added t-meta Tactics, attributes or user commands CI Modifies the continuous integration setup or other automation labels 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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this starts a task even if there is nothing to do, doesn't it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Mar 29, 2026
@kim-em kim-em removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 2, 2026
@kim-em kim-em requested a review from joneugster April 2, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Modifies the continuous integration setup or other automation LLM-generated PRs with substantial input from LLMs - review accordingly t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants