PSeitz / lz4_flex

Fastest pure Rust implementation of LZ4 compression/decompression.
MIT License
441 stars 28 forks source link

Expand Sink abstraction to handle/hide uninitialized data #20

Closed arthurprs closed 3 years ago

arthurprs commented 3 years ago

In order to safe guard against UB (Undefined Behavior) and safety issues (exposing uninitialized data) the Sink abstraction is expanded to handle uninitialized data safely.

Other alternatives were explored (eg. Sink trait) and the alternative in this PR did show just as good performance but with less code churn and compile time impact.

Sink changes

New VecSink

Unsafe Compression changes

Safe compression changes

Safe Decompression changes

Unsafe FrameDecoder changes

Fixes #19

arthurprs commented 3 years ago

Sink is back hehe

Yeah :smile:

Thanks for that, I had no time to tackle this, since I was quite busy relocating.

I'm no stranger to relocation, it's hard.

arthurprs commented 3 years ago

Superseded by #22