Skip to content

Commit

Permalink
Benchmarks and remove output buf from read::Encoder (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger authored Sep 29, 2024
1 parent 3ff0f60 commit e2e066a
Show file tree
Hide file tree
Showing 475 changed files with 31,385 additions and 154 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ jobs:
with:
submodules: recursive

- name: Remove benches/
run: rm -rf benches/

- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross --rev 6d097fb

- name: Build
run: cross build --target ${{ matrix.target }} --release -vv
run: cross build --target ${{ matrix.target }} -vv

- name: Test
run: cross test --target ${{ matrix.target }} --release -vv
run: cross test --target ${{ matrix.target }} -vv

test-wasm32-emscripten:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -77,6 +80,10 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Remove benches/
shell: bash
run: rm -rf benches/

- name: Install nasm
if: runner.os != 'macOS'
uses: ilammy/setup-nasm@v1
Expand All @@ -90,9 +97,9 @@ jobs:
run: brew install automake autoconf coreutils libtool nasm

- name: Test (shared)
run: cargo test --no-default-features --features shared --lib --release -vv
run: cargo test --no-default-features --features shared --lib -vv

- name: Test (static)
run: |
cargo clean # ensure we're starting fresh, no funny business
cargo test --no-default-features --features static --release -vv
cargo test --no-default-features --features static -vv
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ documentation = "https://docs.rs/isal-rs"
homepage = "https://github.com/milesgranger/isal-rs"
repository = "https://github.com/milesgranger/isal-rs"
keywords = ["isal", "isa-l", "igzip", "deflate", "zlib"]
exclude = ["benches/"]

[lib]
name = "isal"
Expand All @@ -25,11 +26,14 @@ use-system-isal = ["isal-sys/use-system-isal"]
isal-sys = { path = "isal-sys", version = "0.4.0+496255c" }

[dev-dependencies]
criterion = "0.3"
criterion = { version = "0.5", features = ["html_reports"] }
md5 = "0.7.0"
flate2 = "^1"
rand = "^0.8"

[[bench]]
name = "igzip"
path = "benches/igzip.rs"
harness = false
html = true

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Supports the following codecs using the ISA-L library under the hood:

Or can use functions of `de/compress` and `de/compress_into`

---

Building requires some system tools like `autotools`, `nasm`, `make`, and anything the official ISA-L repo suggests.
On Windows the build is invoked with `nmake`, other systems use the `./autogen.sh` and `./configure` setups.

---

### Examples:

#### Functions like `compress_into` and `decompress`
Expand Down Expand Up @@ -81,6 +88,12 @@ assert_eq!(decompressed.as_slice(), data);

---

### Benchmarks

Checkout the [README](./benches/README.md) in the benches directory.

---

### Versioning:
Versions are specified in normal SemVer format, and a trailing "`+<< commit hash >>`" to indicate
which commit in [isa-l](https://github.com/intel/isa-l) the crate is built against. ie: `0.1.0+62519d9`
10 changes: 10 additions & 0 deletions benches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#### Summary

Using this crate is much faster than flate2 due to the use of ISA-L under the hood.
However flate2 is _much_ more widely used. I suggest giving this a shot and provide feedback.

#### To run yourself:

- `cd benches`
- `tar -xvzf data.tar.gz`
- `cargo bench`
116 changes: 116 additions & 0 deletions benches/criterion/io__Read Gzip Encoder/alice29.txt/report/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>io::Read Gzip Encoder/alice29.txt Summary - Criterion.rs</title>
<style type="text/css">
body {
font: 14px Helvetica Neue;
text-rendering: optimizelegibility;
}

.body {
width: 960px;
margin: auto;
}

a:link {
color: #1F78B4;
text-decoration: none;
}

h2 {
font-size: 36px;
font-weight: 300;
}

h3 {
font-size: 24px;
font-weight: 300;
}

#footer {
height: 40px;
background: #888;
color: white;
font-size: larger;
font-weight: 300;
}

#footer a {
color: white;
text-decoration: underline;
}

#footer p {
text-align: center
}
</style>
</head>

<body>
<div class="body">
<h2>io::Read Gzip Encoder/alice29.txt</h2>
<h3>Violin Plot</h3>
<a href="violin.svg">
<img src="violin.svg" alt="Violin Plot" />
</a>
<p>This chart shows the relationship between function/parameter and iteration time. The thickness of the shaded
region indicates the probability that a measurement of the given function/parameter would take a particular
length of time.</p>
<section class="plots">
<a href="../../../io__Read Gzip Encoder/isal/alice29.txt/report/index.html">
<h4>io::Read Gzip Encoder/isal/alice29.txt</h4>
</a>
<table width="100%">
<tbody>
<tr>
<td>
<a href="../../../io__Read Gzip Encoder/isal/alice29.txt/report/pdf.svg">
<img src="../../../io__Read Gzip Encoder/isal/alice29.txt/report/pdf_small.svg" alt="PDF of Slope" width="450"
height="300" />
</a>
</td>
<td>
<a href="../../../io__Read Gzip Encoder/isal/alice29.txt/report/regression.svg">
<img src="../../../io__Read Gzip Encoder/isal/alice29.txt/report/regression_small.svg" alt="Regression" width="450"
height="300" />
</a>
</td>
</tr>
</tbody>
</table>
</section>
<section class="plots">
<a href="../../../io__Read Gzip Encoder/flate2/alice29.txt/report/index.html">
<h4>io::Read Gzip Encoder/flate2/alice29.txt</h4>
</a>
<table width="100%">
<tbody>
<tr>
<td>
<a href="../../../io__Read Gzip Encoder/flate2/alice29.txt/report/pdf.svg">
<img src="../../../io__Read Gzip Encoder/flate2/alice29.txt/report/pdf_small.svg" alt="PDF of Slope" width="450"
height="300" />
</a>
</td>
<td>
<a href="../../../io__Read Gzip Encoder/flate2/alice29.txt/report/iteration_times.svg">
<img src="../../../io__Read Gzip Encoder/flate2/alice29.txt/report/iteration_times_small.svg" alt="Iteration Times" width="450"
height="300" />
</a>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<div id="footer">
<p>This report was generated by
<a href="https://github.com/bheisler/criterion.rs">Criterion.rs</a>, a statistics-driven benchmarking
library in Rust.</p>
</div>
</body>

</html>
Loading

0 comments on commit e2e066a

Please sign in to comment.