Add first benchmark to the readme

And fixed a typo
This commit is contained in:
João M. Bezerra 2021-11-03 23:10:18 -03:00
parent f17f7310a3
commit 4486887239
2 changed files with 24 additions and 2 deletions

View File

@ -18,6 +18,7 @@
- [Usage](#usage) - [Usage](#usage)
- [Installation](#installation) - [Installation](#installation)
- [Supported Formats](#supported-formats) - [Supported Formats](#supported-formats)
- [Benchmarks](#benchmarks)
- [Contributing](#contributing) - [Contributing](#contributing)
## Features ## Features
@ -25,7 +26,7 @@
1. Easy to use. 1. Easy to use.
2. Automatic format detection. 2. Automatic format detection.
3. Same syntax, various formats. 3. Same syntax, various formats.
4. Encoding and decoding streams, it's fast. <!-- We should post benchmarks in our wiki and link them here --> 4. Encoding and decoding streams, it's fast.
5. No runtime dependencies (for _Linux x86_64_). 5. No runtime dependencies (for _Linux x86_64_).
6. Listing archive contents with tree formatting (in next release!). 6. Listing archive contents with tree formatting (in next release!).
@ -103,6 +104,24 @@ Formats can be chained (`ouch` keeps it _fast_):
- `.tar.gz.xz.bz.zst` - `.tar.gz.xz.bz.zst`
- `.tar.gz.gz.gz.gz.xz.xz.xz.xz.bz.bz.bz.bz.zst.zst.zst.zst` - `.tar.gz.gz.gz.gz.xz.xz.xz.xz.bz.bz.bz.bz.zst.zst.zst.zst`
## Benchmarks
Comparison made decompressing `linux.tar.gz` and measured with
[`hyperfine`](https://github.com/sharkdp/hyperfine), times are the average.
| Tool | `ouch` | [`tar`] | [`bsdtar`] |
|:------------:|:------:|:-------:|:----------:|
| Average time | 911 ms | 1102 ms | 829 ms |
Note: `ouch` focuses heavily on usage ergonomics and nice error messages, but
we plan on doing some optimization in the future.
Versions used:
- `ouch` _0.3.1_
- [`tar`] _1.34_
- [`bsdtar`] _3.5.2_
## Contributing ## Contributing
`ouch` is 100% made out of voluntary work, any small contribution is welcome! `ouch` is 100% made out of voluntary work, any small contribution is welcome!
@ -110,3 +129,6 @@ Formats can be chained (`ouch` keeps it _fast_):
- Open an issue. - Open an issue.
- Open a pull request. - Open a pull request.
- Share it to a friend! - Share it to a friend!
[`tar`]: https://www.gnu.org/software/tar/
[`bsdtar`]: https://www.freebsd.org/cgi/man.cgi?query=bsdtar&sektion=1&format=html

View File

@ -143,7 +143,7 @@ pub fn run(args: Opts, question_policy: QuestionPolicy) -> crate::Result<()> {
// Note: If input_extensions is empty then it will make `formats` empty too, which we don't want // Note: If input_extensions is empty then it will make `formats` empty too, which we don't want
if !input_extensions.is_empty() && new_formats != formats { if !input_extensions.is_empty() && new_formats != formats {
// Safety: // Safety:
// We checked above that input_extensions isn't empty, so files[0] has a extension. // We checked above that input_extensions isn't empty, so files[0] has an extension.
// //
// Path::extension says: "if there is no file_name, then there is no extension". // Path::extension says: "if there is no file_name, then there is no extension".
// Using DeMorgan's law: "if there is extension, then there is file_name". // Using DeMorgan's law: "if there is extension, then there is file_name".