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

lzbuffer: own output sink instead of holding ref #54

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

cccs-sadugas
Copy link
Contributor

Pull Request Overview

Changes LZBuffer trait to consume the output sink instead of holding a
reference to it. This makes it easier to store the sink and avoids
self-referential structs. It also makes sense for the buffer to own the
sink while it is performing decompression.

This also adds the methods get_output and get_output_mut to access
the output sink.

This pull request is needed by future versions of PR #51.

Testing Strategy

This pull request was tested by...

  • Added relevant unit tests.
  • Added relevant end-to-end tests (such as .lzma, .lzma2, .xz files).

Should already be covered by existing tests.

Supporting Documentation and References

Benchmarks:

master

test compress_65536                  ... bench:   3,187,997 ns/iter (+/- 863,604)
test compress_empty                  ... bench:       1,873 ns/iter (+/- 615)
test compress_hello                  ... bench:       2,072 ns/iter (+/- 608)
test decompress_after_compress_65536 ... bench:   3,624,633 ns/iter (+/- 1,528,450)
test decompress_after_compress_empty ... bench:       4,493 ns/iter (+/- 1,926)
test decompress_after_compress_hello ... bench:       5,452 ns/iter (+/- 5,584)
test decompress_big_file             ... bench:   8,809,873 ns/iter (+/- 5,368,703)
test decompress_huge_dict            ... bench:       4,430 ns/iter (+/- 2,042)

owned_output_sink

test compress_65536                  ... bench:   2,928,550 ns/iter (+/- 1,354,373)
test compress_empty                  ... bench:       1,513 ns/iter (+/- 512)
test compress_hello                  ... bench:       2,410 ns/iter (+/- 742)
test decompress_after_compress_65536 ... bench:   3,295,758 ns/iter (+/- 1,131,631)
test decompress_after_compress_empty ... bench:       3,893 ns/iter (+/- 1,449)
test decompress_after_compress_hello ... bench:       4,687 ns/iter (+/- 1,630)
test decompress_big_file             ... bench:   7,352,772 ns/iter (+/- 2,684,627)
test decompress_huge_dict            ... bench:       5,731 ns/iter (+/- 3,119)

@cccs-sadugas cccs-sadugas mentioned this pull request Jul 14, 2020
2 tasks
Changes `LZBuffer` trait to consume the output sink instead of holding a
reference to it. This makes it easier to store the sink and avoids
self-referential structs. It also makes sense for the buffer to own the
sink while it is performing decompression.

This also adds the methods `get_output` and `get_output_mut` to access
the output sink.
@cccs-sadugas cccs-sadugas mentioned this pull request Jul 14, 2020
4 tasks
Copy link
Owner

@gendx gendx left a comment

Choose a reason for hiding this comment

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

Nice to see that this improves the benchmarks :)

@gendx gendx merged commit c9967d5 into gendx:master Jul 16, 2020
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