You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-5Lines changed: 36 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
# zlib-rs: a safer zlib
7
7
8
-
This repository contains a Rust implementation of the zlib file format that is compatible with the zlib API.
8
+
This repository contains a Rust implementation of the zlib file format that is compatible with the zlib API.
9
9
10
10
This repository contains two public crates:
11
11
@@ -23,14 +23,43 @@ zlib-rs can be used in both Rust and C projects.
23
23
By far the easiest way to use zlib-rs is through the [flate2](https://crates.io/crates/flate2) crate, by simply enabling the `zlib-rs` feature gate. This will enable the `zlib-rs`
24
24
backend.
25
25
26
-
## C projects
26
+
###C projects
27
27
28
28
zlib-rs can be built as a shared object file for usage by C programs that dynamically link to zlib. Please see the example in [libz-rs-sys-cdylib](https://github.com/trifectatechfoundation/zlib-rs/tree/main/libz-rs-sys-cdylib).
29
29
30
-
## Acknowledgment
30
+
## Performance
31
31
32
-
This project is heavily based on the [zlib](https://github.com/madler/zlib) and
The resulting binary statically assumes the SIMD capabilities of the current machine.
47
+
48
+
Note: binaries built with `-Ctarget-cpu` almost certainly crash on systems that don't have the specified CPU! Only use this flag if you control how the binary is deployed, and can guarantee that the CPU assumptions are never violated.
49
+
50
+
#### `-Cllvm-args=-enable-dfa-jump-thread`
51
+
52
+
For best performance with very small input sizes, compile with:
This flag gives around a 10% boost when the input arrives in chunks of 16 bytes, and a couple percent when input arrives in chunks of under 1024 bytes. Beyond that, the effect is not significant. Using this flag can lead to longer compile times, but otherwise has no adverse effects.
59
+
60
+
## Acknowledgments
61
+
62
+
This project is heavily based on the [zlib](https://github.com/madler/zlib) and [zlib-ng] projects.
34
63
35
64
## About
36
65
@@ -39,3 +68,5 @@ zlib-rs is part of Trifecta Tech Foundation's [Data compression initiative](http
39
68
## History
40
69
41
70
The initial development of zlib-rs was started and funded by the [Internet Security Research Group](https://www.abetterinternet.org/) as part of the [Prossimo project](https://www.memorysafety.org/).
The resulting binary statically assumes the SIMD capabilities of the current machine.
133
+
134
+
Note: binaries built with `-Ctarget-cpu` almost certainly crash on systems that don't have the specified CPU! Only use this flag if you control how the binary is deployed, and can guarantee that the CPU assumptions are never violated.
135
+
136
+
#### `-Cllvm-args=-enable-dfa-jump-thread`
137
+
138
+
For best performance with very small input sizes, compile with:
This flag gives around a 10% boost when the input arrives in chunks of 16 bytes, and a couple percent when input arrives in chunks of under 1024 bytes. Beyond that, the effect is not significant. Using this flag can lead to longer compile times, but otherwise has no adverse effects.
0 commit comments