Closed Lokathor closed 1 year ago
Yeah that seems reasonable.
I've implemented this in a with-alloc
branch here:
with-alloc
feature is enabled by defaultdeflate
and a few parts of inflate
that require allocationHappy to open a PR, if you're willing to bring it in!
Yeah that looks good. I suspect this would be a breaking change that would require a version bump though?
Also gonna need some help to check that it works fine with rustc-dep-of-std but that's not critical yet (think that's still on an older version than the current one.)
Yeah, I wasn't totally sure about whether this would be breaking, and the docs didn't say anything about "adding a new feature and making it enabled by default".
I think it would only break in cases where people import the library with default-features = false
. Doing so would be a no-op until this change, since there weren't any default features!
Anyways, I've bumped the version, added some docs, and opened a PR here.
Ironically, after testing it out, I'm probably not going to use it in my embedded system: it reduces a compressed object's size by 9.7K, but adds 11.5K of code to decompress it, for a slight net size increase 😅
Regardless of Matt's use case, I would love to see this integrated. :-)
yeah it's been merged in, just not in a release yet as I wanted to look at a few API tweaks for a version bumps.
yeah it's been merged in, just not in a release yet as I wanted to look at a few API tweaks for a version bumps.
Uh, I totally didn't miss that or anything. :-)
Thanks! I'm excited for the new release.
Released now, would probably be doable to do the same with compression later if there is interest.
It seems like the core decompression routines can be performed without allocating at all.
We should make the use of the
alloc
crate optional behind a cargo feature, though this would be a breaking release to do so.