Skip to content

Use hubtools function to get file metadata without extraction#702

Open
mkeeter wants to merge 2 commits into
masterfrom
mkeeter/only-extract-tasks
Open

Use hubtools function to get file metadata without extraction#702
mkeeter wants to merge 2 commits into
masterfrom
mkeeter/only-extract-tasks

Conversation

@mkeeter

@mkeeter mkeeter commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

oxidecomputer/hubtools#65 allows us to get file metadata without extracting the file.

When loading the archive, this can be significant (because the auxiliary flash image is chunky). On my machine, this yields a 16% improvement in test suite runtime (cargo test --release): from 31.4s to 26.1s.

It also lets us hide the zip internals in humility extract.

@mkeeter mkeeter requested a review from labbott June 17, 2026 15:34
@mkeeter mkeeter force-pushed the mkeeter/only-extract-tasks branch 2 times, most recently from 611519b to 83c0786 Compare June 17, 2026 18:20
@mkeeter mkeeter force-pushed the mkeeter/only-extract-tasks branch from 83c0786 to 5b5ed1e Compare June 17, 2026 19:18
@mkeeter mkeeter requested review from evan-oxide and jamesmunns June 17, 2026 19:19

@jamesmunns jamesmunns left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks reasonable to me! One note, but it's a complaint about zip's API, not anything you did.

Comment thread cmd/extract/src/lib.rs
for i in 0..archive.len() {
let file = archive.by_index(i)?;
println!("{:12} {}", file.size(), file.name());
for i in 0..archive.file_count()? {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It seems like we might want a file iterator for this, not sure if this is something we do or if it's a dependency thing yet, will check.

edit: nope, it's a zip::ZipArchive thing, and doing it by index is actually how they recommend doing it in their example. Boo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants