perf: parallel Unzip, klauspost/compress zip, modern Go - #36
Open
joshowen wants to merge 1 commit into
Open
Conversation
- Replace archive/zip with github.com/klauspost/compress/zip for faster assembly-optimised deflate on both compress and decompress - Parallelise Unzip using a runtime.NumCPU() worker pool; each file is decompressed concurrently via os.File.ReadAt (pread-safe) - Pre-create all directories before spawning goroutines to avoid races - Extract extractZipFile helper for clarity - Fix Zip: filepath.Walk return value was silently ignored; walk errors are now propagated correctly - Fix Zip: walk callback err parameter was shadowed immediately, preventing detection of mid-walk filesystem errors - Update go directive: 1.16 -> 1.23 - Update CI: actions/checkout@v2->v4, actions/setup-go@v2->v5, go-version: stable, ubuntu-20.04/windows-2019 -> latest Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Speeds up cache restore/save by using multiple CPU cores for decompression, switching to a faster zip library, and modernising the Go toolchain.
Changes
Parallel decompression (
Unzip)runtime.NumCPU()worker pool so files are decompressed concurrentlyextractZipFilehelper for clarityos.File.ReadAt(used internally by the zip reader) ispread(2)-safe, so concurrent access to the same zip archive fd is correctFaster zip library (
archive/zip→github.com/klauspost/compress/zip)Bug fixes in
Zipfilepath.Walkreturn value was silently discarded; errors during walking are now propagatederrparameter was immediately shadowed by:=, hiding mid-walk filesystem errorsModern Go / CI
godirective:1.16→1.23actions/checkout: v2 → v4actions/setup-go: v2 → v5,go-version: stableubuntu-20.04/windows-2019→latest