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

Gate logging behind an opt-in feature. #31

Merged
merged 3 commits into from
Mar 5, 2020
Merged

Gate logging behind an opt-in feature. #31

merged 3 commits into from
Mar 5, 2020

Conversation

gendx
Copy link
Owner

@gendx gendx commented Mar 5, 2020

Pull Request Overview

This pull request fixes #18. There is a new optional feature, enable_logging to turn on logging. When turned off (now default), the lzma_trace! and similar macros are no-ops.

This also removes the need for the log dependency (and all of its transitive dependencies) when turned off.

Benchmarks

$ cargo bench --features enable_logging
running 8 tests
test compress_65536                  ... bench:   4,330,374 ns/iter (+/- 79,850)
test compress_empty                  ... bench:       2,221 ns/iter (+/- 370)
test compress_hello                  ... bench:       3,217 ns/iter (+/- 225)
test decompress_after_compress_65536 ... bench:   5,835,689 ns/iter (+/- 96,176)
test decompress_after_compress_empty ... bench:      10,845 ns/iter (+/- 553)
test decompress_after_compress_hello ... bench:      12,425 ns/iter (+/- 689)
test decompress_big_file             ... bench:   9,750,036 ns/iter (+/- 460,925)
test decompress_huge_dict            ... bench:      12,619 ns/iter (+/- 424)

$ cargo bench
running 8 tests
test compress_65536                  ... bench:   2,377,692 ns/iter (+/- 15,781)
test compress_empty                  ... bench:       2,067 ns/iter (+/- 64)
test compress_hello                  ... bench:       2,733 ns/iter (+/- 358)
test decompress_after_compress_65536 ... bench:   3,815,474 ns/iter (+/- 72,097)
test decompress_after_compress_empty ... bench:      10,760 ns/iter (+/- 5,275)
test decompress_after_compress_hello ... bench:      11,865 ns/iter (+/- 75)
test decompress_big_file             ... bench:   7,416,332 ns/iter (+/- 40,416)
test decompress_huge_dict            ... bench:      12,082 ns/iter (+/- 238)

$ cargo bench --features enable_logging
running 8 tests
test compress_65536                  ... bench:   4,330,374 ns/iter (+/- 79,850)
test compress_empty                  ... bench:       2,221 ns/iter (+/- 370)
test compress_hello                  ... bench:       3,217 ns/iter (+/- 225)
test decompress_after_compress_65536 ... bench:   5,835,689 ns/iter (+/- 96,176)
test decompress_after_compress_empty ... bench:      10,845 ns/iter (+/- 553)
test decompress_after_compress_hello ... bench:      12,425 ns/iter (+/- 689)
test decompress_big_file             ... bench:   9,750,036 ns/iter (+/- 460,925)
test decompress_huge_dict            ... bench:      12,619 ns/iter (+/- 424)

$ cargo bench
running 8 tests
test compress_65536                  ... bench:   2,377,692 ns/iter (+/- 15,781)
test compress_empty                  ... bench:       2,067 ns/iter (+/- 64)
test compress_hello                  ... bench:       2,733 ns/iter (+/- 358)
test decompress_after_compress_65536 ... bench:   3,815,474 ns/iter (+/- 72,097)
test decompress_after_compress_empty ... bench:      10,760 ns/iter (+/- 5,275)
test decompress_after_compress_hello ... bench:      11,865 ns/iter (+/- 75)
test decompress_big_file             ... bench:   7,416,332 ns/iter (+/- 40,416)
test decompress_huge_dict            ... bench:      12,082 ns/iter (+/- 238)
@gendx
Copy link
Owner Author

gendx commented Mar 5, 2020

bors r+

bors bot added a commit that referenced this pull request Mar 5, 2020
31: Gate logging behind an opt-in feature. r=gendx a=gendx

### Pull Request Overview

This pull request fixes #18. There is a new optional feature, `enable_logging` to turn on logging. When turned off (now default), the `lzma_trace!` and similar macros are no-ops.

This also removes the need for the `log` dependency (and all of its transitive dependencies) when turned off.


### Benchmarks

```
$ cargo bench --features enable_logging
running 8 tests
test compress_65536                  ... bench:   4,330,374 ns/iter (+/- 79,850)
test compress_empty                  ... bench:       2,221 ns/iter (+/- 370)
test compress_hello                  ... bench:       3,217 ns/iter (+/- 225)
test decompress_after_compress_65536 ... bench:   5,835,689 ns/iter (+/- 96,176)
test decompress_after_compress_empty ... bench:      10,845 ns/iter (+/- 553)
test decompress_after_compress_hello ... bench:      12,425 ns/iter (+/- 689)
test decompress_big_file             ... bench:   9,750,036 ns/iter (+/- 460,925)
test decompress_huge_dict            ... bench:      12,619 ns/iter (+/- 424)

$ cargo bench
running 8 tests
test compress_65536                  ... bench:   2,377,692 ns/iter (+/- 15,781)
test compress_empty                  ... bench:       2,067 ns/iter (+/- 64)
test compress_hello                  ... bench:       2,733 ns/iter (+/- 358)
test decompress_after_compress_65536 ... bench:   3,815,474 ns/iter (+/- 72,097)
test decompress_after_compress_empty ... bench:      10,760 ns/iter (+/- 5,275)
test decompress_after_compress_hello ... bench:      11,865 ns/iter (+/- 75)
test decompress_big_file             ... bench:   7,416,332 ns/iter (+/- 40,416)
test decompress_huge_dict            ... bench:      12,082 ns/iter (+/- 238)
```

Co-authored-by: G. Endignoux <ggendx@gmail.com>
@bors
Copy link
Contributor

bors bot commented Mar 5, 2020

Canceled

@gendx
Copy link
Owner Author

gendx commented Mar 5, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 5, 2020

Build succeeded

@bors bors bot merged commit 3fcf0bb into master Mar 5, 2020
@bors bors bot deleted the optional-logging branch March 5, 2020 23:24
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.

Make debug/tracing optional
1 participant