Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package fetching: support .tar.zst archives #17552

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

dweiller
Copy link
Contributor

@dweiller dweiller commented Oct 16, 2023

Resolves #14299.

I have tested this with zig fetch on a local .tar.zst archive, but I'm not aware of any code forges online that produce zstandard compressed archives. As I haven't been able to test against code forges I have not added any http content type recognition - should I just add application/zstd and/or application/tar+zstd or leave it until someone needs it in the future?

@andrewrk
Copy link
Member

Thanks!

Yes please add the proper mime type detection as well. You should be able to find an official mime type database somewhere; no need to find an example web server, just support the standard.

@andrewrk
Copy link
Member

Can you also share how this affects compiler binary size? The zstd implementation looks a bit hefty. Since it's a less commonly used format, it might make sense to rely on a fetch plugin for this one if it adds too much bloat to the compiler.

@dweiller
Copy link
Contributor Author

dweiller commented Oct 17, 2023

Can you also share how this affects compiler binary size? The zstd implementation looks a bit hefty. Since it's a less commonly used format, it might make sense to rely on a fetch plugin for this one if it adds too much bloat to the compiler.

Looks like the difference is exactly 26KiB (before the couple extra bytes from adding zstd mime type):

> du -b zig-zstd-fetch zig-ca690ffa2
207191680	zig-zstd-fetch
207165056	zig-ca690ffa2
> echo "207191680 - 207165056" | bc
26624
> echo "1024 * 26" | bc
26624

These numbers are for ReleaseFast (compiled via cmake with -DCMAKE_BUILD_TYPE=Release)

@andrewrk
Copy link
Member

I think those sizes are unstripped, yeah? You'll probably see an even smaller delta if you run strip on them to remove debug info.

@dweiller
Copy link
Contributor Author

dweiller commented Oct 17, 2023

I think it would have been unstripped - is there a particular invocation of strip you recommend? Running each through strip -s removed only 8 bytes from each

@andrewrk
Copy link
Member

I got the same as you and I was briefly surprised, however, I figured it out. We both have configured cmake with -DCMAKE_BUILD_TYPE=Release as opposed to -DCMAKE_BUILD_TYPE=RelWithDebInfo so it ends up passing -Dstrip to zig build when self-hosting.

So - never mind, I think your original sizes are already stripped. Thanks for checking!

@dweiller
Copy link
Contributor Author

dweiller commented Oct 17, 2023

I've added detection for the application/zstd content type and rebased. The latest zig nightly download is smaller by about 47MiB than what I get compiling on my machine, with fewer sections in the elf file, so a smaller compiler can be produced which might change the delta.

@andrewrk andrewrk enabled auto-merge (rebase) October 17, 2023 04:48
@dweiller
Copy link
Contributor Author

Looks like the x86-64_windows-debug CI job hit 6 hours and timed out.

@truemedian
Copy link
Contributor

Can you also share how this affects compiler binary size?

Just a note: the compiler already depends on the zstd implementation through std.http (for http decompression), so it shouldn't bloat size much if at all.

@andrewrk
Copy link
Member

Gotcha, thanks for pointing that out!

@andrewrk andrewrk merged commit f58811a into ziglang:master Oct 17, 2023
10 checks passed
@dweiller dweiller deleted the zstandard-package branch October 18, 2023 02:38
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.

support fetching dependencies bundled with .tar.zst extension
3 participants