Skip to content

feat: add configurable compression level to SD0 converter#18

Merged
Xiphoseer merged 3 commits into
LUDevNet:mainfrom
aronwk-aaron:configurable-compression
Jun 25, 2026
Merged

feat: add configurable compression level to SD0 converter#18
Xiphoseer merged 3 commits into
LUDevNet:mainfrom
aronwk-aaron:configurable-compression

Conversation

@aronwk-aaron

@aronwk-aaron aronwk-aaron commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an optional compression field to the Converter struct, allowing callers to specify a compression level (0-9) instead of always using Compression::best() (9)
  • Defaults to best compression when not set, preserving backwards compatibility

Motivation

When building during, level 9 compression is unnecessarily slow with not enough benefit in compression. This allows tools like LUpdate to offer a --compression flag for faster builds while keeping maximum compression available for those that want it.

Test plan

  • Verify existing callers that don't set compression still get Compression::best()
  • Verify setting compression: Some(Compression::new(1)) produces valid SD0 output at faster speed

🤖 Generated with Claude Code

Allow callers to specify a compression level (0-9) instead of always
using best (9). This enables faster builds during development while
keeping the option for maximum compression in release builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aronwk-aaron

Copy link
Copy Markdown
Contributor Author

The lint failure is a pre-existing issue unrelated to this PR's changes. It's caused by an older version of the displaydoc crate triggering the non_local_definitions lint (now denied under -D warnings) in modules/core/src/buffer.rs and modules/core/src/reader.rs. Updating displaydoc with cargo update -p displaydoc should fix it.

@aronwk-aaron aronwk-aaron marked this pull request as ready for review June 23, 2026 18:04
Comment thread modules/pack/src/sd0/fs.rs Outdated
Comment thread modules/pack/src/sd0/fs.rs Outdated
aronwk-aaron and others added 2 commits June 23, 2026 15:21
Address review feedback:
- Change compression field from Option<Compression> to Option<u32> to
  avoid leaking flate2's Compression type in the public API
- Use unwrap_or_else(Compression::best) to avoid eager evaluation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
RemFile was incorrectly using ArgEffect::Include instead of
ArgEffect::Exclude, causing file exclusions to be treated as inclusions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Xiphoseer Xiphoseer merged commit be12af0 into LUDevNet:main Jun 25, 2026
2 of 3 checks passed
@aronwk-aaron aronwk-aaron deleted the configurable-compression branch June 25, 2026 10:40
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.

2 participants