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

Switch to rle_decode_fast crate #38

Merged
merged 7 commits into from
Jul 2, 2019
Merged

Conversation

Shnatsel
Copy link
Contributor

Use rle_decode_fast crate created by @WanzenBug and me instead of a bespoke unsafe block relying on non-local invariants.

This change improves performance by about 10% 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'

Before:

  Time (mean ± σ):      2.295 s ±  0.016 s    [User: 2.275 s, System: 0.013 s]
  Range (min … max):    2.268 s …  2.320 s    25 runs

After:

  Time (mean ± σ):      2.079 s ±  0.022 s    [User: 2.069 s, System: 0.010 s]
  Range (min … max):    2.046 s …  2.132 s    25 runs

We're created the crate to solve recurring safety problems in RLE decoding. It contains a single unsafe block, which is a copy of append_from_within() function from this Rust RFC. We're reasonably confident it is sound because it's mostly a copy of a pre-exisitng stdlib function, and I cannot find anything wrong with its logic.

@codecov-io
Copy link

codecov-io commented Jun 30, 2019

Codecov Report

Merging #38 into master will decrease coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #38     +/-   ##
=========================================
- Coverage   91.46%   91.36%   -0.1%     
=========================================
  Files          14       14             
  Lines        1300     1285     -15     
=========================================
- Hits         1189     1174     -15     
  Misses        111      111
Impacted Files Coverage Δ
src/lib.rs 100% <ø> (ø) ⬆️
src/util.rs 91.17% <ø> (-1.33%) ⬇️
src/non_blocking/deflate/decode.rs 86.14% <100%> (-0.72%) ⬇️

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 bf3c6c3...912fabd. Read the comment docs.

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.

Great! Many thanks for your contribution.

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.

3 participants