Zstd announcement#76
Conversation
|
|
||
| Using zstd in rust is already supported via the [zstd](https://crates.io/crates/zstd) crate, so why bother with a whole new implementation? | ||
|
|
||
| One practical advantage of rust is that it is straightforward to write portable software. Currently the `zstd` crate compiles the C code from source, which requires a C toolchain for the target and for the target to be supported at all. Setting up a C toolchain on windows or for webassembly can be a challenge, and isn't needed with a pure-rust implementation. For rust programmers, using dependencies written in rust is a superior experience. |
There was a problem hiding this comment.
| One practical advantage of rust is that it is straightforward to write portable software. Currently the `zstd` crate compiles the C code from source, which requires a C toolchain for the target and for the target to be supported at all. Setting up a C toolchain on windows or for webassembly can be a challenge, and isn't needed with a pure-rust implementation. For rust programmers, using dependencies written in rust is a superior experience. | |
| ### Portability | |
| One practical advantage of rust is that it is straightforward to write portable software. Currently the `zstd` crate compiles the C code from source, which requires a C toolchain for the target and for the target to be supported at all. Setting up a C toolchain on windows or for webassembly can be a challenge, and isn't needed with a pure-rust implementation. For rust programmers, using dependencies written in rust is a superior experience. |
|
|
||
| By default decompression performance of our implementation is a couple percent slower than the C reference implementation. We believe we can justify this though, because with the `unsafe-performance-experimental` feature flag enabled we match C performance. | ||
|
|
||
| This feature flag disables 4 bounds checks where data from the input is used to index into a data structure. For most users a ~3% performance regression is likely an acceptable price to pay for increased memory safety. If you really need that last bit of performance, you can enable the flag at your own risk. Its behavior matches C which also does not check the bounds and appears to run just fine in many production systems. |
There was a problem hiding this comment.
Maybe note how the number of unsafe operations relates to the unsafety of the C impl.
This can read as "you're back to the unsafety of the C impl"
|
|
||
| ### The cost of memory safety | ||
|
|
||
| By default decompression performance of our implementation is a couple percent slower than the C reference implementation. We believe we can justify this though, because with the `unsafe-performance-experimental` feature flag enabled we match C performance. |
There was a problem hiding this comment.
Link to benchmark suite?
|
|
||
| The reference implementation was initially translated using [`c2rust`](https://c2rust.com/) , and we have since completed the cleanup work for decompression and the dictionary builder. | ||
|
|
||
| We test our rust code (compiled into a C static library) with the the reference implementation's test suite. We additionally use fuzz testing and Miri, so we're fairly confident in the correctness of our implementation. |
There was a problem hiding this comment.
| We test our rust code (compiled into a C static library) with the the reference implementation's test suite. We additionally use fuzz testing and Miri, so we're fairly confident in the correctness of our implementation. | |
| We test our Rust code (compiled into a C static library) with the the reference implementation's test suite. We additionally use fuzz testing and Miri, so we're fairly confident in the correctness of our implementation. |
Co-authored-by: Erik Jonkers <erik@tweedegolf.com> Co-authored-by: Liset <116883252+LisetRoos@users.noreply.github.com>
|
|
||
| We test our rust code (compiled into a C static library) with the the reference implementation's test suite. We additionally use fuzz testing and Miri, so we're confident in the correctness of our implementation. | ||
|
|
||
| The release is available here: <TODO: link to release>. |
There was a problem hiding this comment.
So we have https://crates.io/crates/libzstd-rs-sys/0.0.1-prerelease.1 which is what google uses. Do we want something more official? I'd still classify the current code as beta, there is still more unsafe in there than we'd like, and it's not yet seen serious third-party testing (google is working on it, from what I understand)
9f83091 to
50bd389
Compare
|
|
||
| We test our Rust code (compiled into a C static library) with the the reference implementation's test suite. We additionally use fuzz testing and Miri, so we're confident in the correctness of our implementation. | ||
|
|
||
| The pre-release is available here: <TODO: link to release>. |
There was a problem hiding this comment.
Add link after release of ~ 0.0.1.prelease2
No description provided.