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

Improve decode code of read_non_compressed_block() #39

Merged
merged 1 commit into from Jul 23, 2019

Conversation

Stargateur
Copy link
Contributor

Should improve previous #34 I also try to run hyperfine -m 25 --warmup=3 'target/release/examples/flate -i enwiki-latest-all-titles-in-ns0.gz -o /dev/null gzip-decode' on my VM of arch with a file found here I suppose it's the good one.

I see a little improve from 4.417 +- 0.187 s to 4.193 +- 0.111 s, well I don't really trust this kind of bench on one machine but anyway I was curious.

I don't really know what should be put in the error message in case the read is not complete.

@codecov-io
Copy link

codecov-io commented Jul 21, 2019

Codecov Report

Merging #39 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
- Coverage   91.36%   91.34%   -0.02%     
==========================================
  Files          14       14              
  Lines        1285     1283       -2     
==========================================
- Hits         1174     1172       -2     
  Misses        111      111
Impacted Files Coverage Δ
src/util.rs 90.9% <0%> (-0.27%) ⬇️
src/deflate/encode.rs 96.59% <0%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2efa0ab...15811cb. Read the comment docs.

@Shnatsel
Copy link
Contributor

Shnatsel commented Jul 21, 2019

I am seeing only a marginal improvement. Before:

  Time (mean ± σ):      2.081 s ±  0.019 s    [User: 2.068 s, System: 0.013 s]
  Range (min … max):    2.055 s …  2.128 s    25 runs

After:

  Time (mean ± σ):      2.050 s ±  0.028 s    [User: 2.038 s, System: 0.011 s]
  Range (min … max):    2.022 s …  2.112 s    25 runs

As measured with hyperfine -m 25 --warmup=3 'target/release/examples/flate -i enwiki-latest-all-titles-in-ns0.gz -o /dev/null gzip-decode'

The good news is that these numbers are stable between runs, so we can rely on them being accurate.

The change looks good to me. The use of take() + read_to_end() is clever!

@Stargateur
Copy link
Contributor Author

damn didn't have time to fix I forget to run cargo fmt XD

@Shnatsel
Copy link
Contributor

My approval means nothing, I'm just a bystander. We'll need the maintainer to take a look, so you have plenty of time.

Copy link
Owner

@sile sile left a comment

Choose a reason for hiding this comment

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

LGTM.
Thanks! > @Stargateur @Shnatsel

@sile sile merged commit 22d1090 into sile:master Jul 23, 2019
@Stargateur Stargateur deleted the improve-decode-code branch July 23, 2019 08:35
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.

None yet

4 participants