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

Allow overriding compression levels with environment variables #212

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

fasterthanlime
Copy link
Contributor

This introduces three environment variables, with the following defaults:

  • AXOASSET_GZ_LEVEL=6
  • AXOASSET_XZ_LEVEL=9
  • AXOASSET_ZSTD_LEVEL=3

(The defaults are unchanged, but when we iterate on dist builds using dist itself, exporting AXOASSET_XZ_LEVEL=1 will make it go faster — it is genuinely the blocker on warm builds lol)

This introduces three environment variables, with the following defaults:

  * `AXOASSET_GZ_LEVEL=6`
  * `AXOASSET_XZ_LEVEL=9`
  * `AXOASSET_ZSTD_LEVEL=3`

(The defaults are unchanged, but when we iterate on dist builds using
dist itself, exporting `AXOASSET_XZ_LEVEL=1` will make it go faster —
it is _genuinely_ the blocker on warm builds lol)
Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

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

small comment re adding some comments, otherwise lgtm

std::env::var("AXOASSET_GZ_LEVEL")
.ok()
.and_then(|val| val.parse().ok())
.unwrap_or(6)
Copy link
Member

Choose a reason for hiding this comment

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

i am trusting you that the default values are good- it may be useful to comment why you picked those, but i wouldn't consider it a blocker

Copy link
Contributor

Choose a reason for hiding this comment

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

6 seems like a good default - checking the gzip manpages, both BSD and GNU gzip default to 6. Agree that a comment would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the numeric values you're seeing here is what axoasset currently does — it just wasn't visible in the code until now.

I followed the thread to find out what compression level it was actually applying, and.. the only default that jumps out to me is the .xz one, I think at 9 it's a little extreme.

However, changing the default would be user-facing so we need to talk about it, announce it in advance, provide cargo-dist config to tune it, etc. — all best left for follow-ups.

@fasterthanlime fasterthanlime merged commit b41e0ac into main Oct 30, 2024
14 checks passed
@fasterthanlime fasterthanlime deleted the axoasset-compression-levels branch October 30, 2024 20:00
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