-
Notifications
You must be signed in to change notification settings - Fork 143
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
Automated Themis Core benchmarks #580
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
69baacd
Themis Core benchmarks
ilammy 7efd75e
Run benchmarks on CI
ilammy 28abeaf
Mention benchmarks in CHANGELOG
ilammy b0149a5
fixup! Themis Core benchmarks
ilammy 64ac6ff
fixup! Themis Core benchmarks
ilammy e1d075a
Fix typos in benches/themis/README.md
ilammy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ⏱ Themis benchmarks | ||
|
||
Here you can find benchmarks used to measure overhead and performance of Themis and its wrappers. | ||
|
||
## 👾 Themis Core | ||
|
||
These are the main benchmarks for Themis. | ||
They establish a baseline for perfomance: | ||
high-level language wrappers generally add overhead to Core. | ||
|
||
See [`themis`](themis) directory for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Criterion output | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "themis-core-bench" | ||
version = "0.0.0" | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
themis = { version = "0.12", path = "../../src/wrappers/themis/rust" } | ||
libthemis-sys = { version = "0.12", path = "../../src/wrappers/themis/rust/libthemis-sys" } | ||
|
||
[dev-dependencies] | ||
criterion = "0.3" | ||
|
||
[[bench]] | ||
name = "secure_cell_seal_master_key" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# ⏱ Themis Core benchmarks | ||
|
||
## Quickstart | ||
|
||
Themis Core benchmarks are written using [**Criterion.rs**](https://bheisler.github.io/criterion.rs/book/criterion_rs.html) statistical benchmarking tool. | ||
|
||
You will need Rust toolchain installed to run benchmarks. | ||
[Visit rustup.rs](https://rustup.rs/) to install Rust. | ||
|
||
1. 📦 **Install Themis Core** | ||
|
||
Benchmarks use Themis library from the system by default. | ||
<!-- TODO: use local builds if available --> | ||
|
||
Normally, this should be enough to install Themis: | ||
|
||
```bash | ||
make install | ||
``` | ||
|
||
If it doesn’t work (or this is your first time building Themis) | ||
then you might need to [review the documentation](https://docs.cossacklabs.com/pages/documentation-themis/#building-and-installing). | ||
|
||
If it still doesn’t work, please [file an issue](https://github.com/cossacklabs/themis/issues/new?labels=bug,installation,core&template=bug_report.md&title=). | ||
|
||
2. ⚙️ **Change directory from repository root** | ||
|
||
```bash | ||
cd benches/themis | ||
``` | ||
|
||
It’s not required but you would have to type less. | ||
|
||
3. ⏳ **Build dependencies** | ||
|
||
```bash | ||
cargo bench --no-run | ||
``` | ||
|
||
Criterion.rs has quite a few dependencies so be patient, | ||
you need to do this only once. | ||
|
||
4. 🚀 **Run some benchmarks** | ||
|
||
```bash | ||
cargo bench -- "Secure Cell .* Seal, master key/64 KB" | ||
``` | ||
|
||
[See FAQ](#faq) for more information on how and what you can run. | ||
|
||
5. 📊 **Analyze result report** | ||
|
||
```bash | ||
open target/criterion/report/index.html | ||
``` | ||
|
||
Done! 🎉 | ||
|
||
## Coverage | ||
|
||
### Secure Cell | ||
|
||
| | Master keys | Passphrases | | ||
| ----------------- | ------------- | ------------- | | ||
| Seal | ✅ complete | 🛠 WIP | | ||
| Token Protect | 💭 soon | 🛠 WIP | | ||
| Context Imprint | 💭 soon | ➖ N/A | | ||
|
||
### Secure Message | ||
|
||
| | ECDSA | RSA | | ||
| ----------------- | ------------- | ------------- | | ||
| Encrypt / Decrypt | 💭 soon | 💭 soon | | ||
| Sign / Verify | 💭 soon | 💭 soon | | ||
|
||
### Secure Session | ||
|
||
💭 soon | ||
|
||
### Secure Comparator | ||
|
||
💭 soon | ||
|
||
<!-- | ||
|
||
## Benchmark results | ||
|
||
TODO: describe current benchmark results here | ||
|
||
--> | ||
|
||
## FAQ | ||
|
||
First of all, it’s a good idea to familiarize yourself with | ||
[Criterion.rs User Guide](https://bheisler.github.io/criterion.rs/book/criterion_rs.html), | ||
especially sections on | ||
[command-line options](https://bheisler.github.io/criterion.rs/book/user_guide/command_line_options.html), | ||
[output format](https://bheisler.github.io/criterion.rs/book/user_guide/command_line_output.html), | ||
and [interpreting results](https://bheisler.github.io/criterion.rs/book/analysis.html). | ||
|
||
**Q:** What benchmarks are available? | ||
|
||
```bash | ||
cargo bench -- --list | ||
``` | ||
|
||
**Q:** How do I run one of them? | ||
|
||
```bash | ||
cargo bench -- 'one of them' # filter by regular expression | ||
``` | ||
|
||
**Q:** How do I see if my optimizations have an effect? | ||
|
||
```bash | ||
git checkout feature | ||
cargo bench -- --save-baseline feature-unoptimized | ||
|
||
git checkout optimizations | ||
# Work on performance | ||
# ... | ||
|
||
# Compare against the baseline version | ||
cargo bench -- --baseline feature-unoptimized | ||
``` | ||
|
||
Don’t forget to _reinstall_ Themis Core library every time you make a change in it and want to measure it. | ||
<!-- TODO: and to pester maintainers to support local builds --> | ||
|
||
**Q:** Benchmarking takes ages, what can I do? | ||
|
||
```bash | ||
cargo bench -- --sample-size 20 # cannot be lower than 10 | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬