Miscellaneous cleanup and improvements - #1
Open
tox-wtf wants to merge 7 commits into
Open
Conversation
`WorldFlags` wraps `u8`. It's more efficient to pass arguments this small by value than by reference.
Convenient though it may be, `zstd::decode_all()` repeatedly allocates
memory for a new `result` vector[^1]. We can dodge these unnecessary
allocations by calling `zstd::stream::copy_decode()` directly and
allocating `uncompressed_chunks_size` bytes to an `uncompressed` vector
once.
I renamed the vector associated with `uncompressed_chunks_size` from
`decoded` to `uncompressed` for consistency.
[^1]: See code for `zstd::decode_all()`:
```rust
pub fn decode_all<R: io::Read>(source: R) -> io::Result<Vec<u8>> {
let mut result = Vec::new();
copy_decode(source, &mut result)?;
Ok(result)
}
```
More informative logs and address a lint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patchset contains some small changes I made while poking around the library. See commit descriptions for more information.
Warning
I'm pretty sure I didn't break anything, but please test this. There's no test suite, and I don't know where to get my hands on test data.