Comments (7)
How much increased time would be tolerable? I have no idea how much time is normal for a print to take, but it is expected for them to tax the system a little bit.
from ouch.
How much increased time would be tolerable?
I'm not sure, we would need to investigate it further, we might even conclude at the end that our current time is tolerable or can be improved.
Let's see, I ran the same command and redirected the output to the file output_file
.
ouch decompress --yes linux-5.14.9.arch2-1-x86_64.pkg.tar.zst &> output_file
Now, we can show the contents in the terminal.
time cat output_file
It showed 0.145 seconds in the first run, and 0.045s for some of the consecutive runs.
That means that the terminal can display the same text in amount 0.045
seconds, if we take the minimum (this can be misleading if I'm missing something).
Here is the time it takes to decompressing the linux package with and without displaying the output:
time ouch decompress --yes linux-5.14.9.arch2-1-x86_64.pkg.tar.zst
# 0.95s on average
time ouch decompress --yes linux-5.14.9.arch2-1-x86_64.pkg.tar.zst &> output_file
# 0.82s on average
So it's an addition of 130 milliseconds.
from ouch.
It's common to speed up this by using an additional buffer, here's an example from coreutils
:
https://github.com/GrayJack/coreutils/blob/dev/uniq/src/main.rs#L25-L32
This saves on OS calls to write into the stdout
file descriptor, but in our case, the problem is probably with how terminals implement their flushing (it depends on the terminal, one of them can try flushing by every frame if too much flush is demanded).
from ouch.
tested on 2c5a57c, got a slightly different result
[...]
Time (mean ± σ): 6.137 s ± 0.745 s [User: 3.145 s, System: 2.873 s]
Range (min … max): 5.589 s … 7.551 s 10 runs
Benchmark #2: target/release/ouch d linux.tar.gz -yo '/tmp/tmp.nhJZkRNvMD' > '/tmp/tmp.nhJZkRNvMD/log'
Time (mean ± σ): 5.366 s ± 0.087 s [User: 2.813 s, System: 2.406 s]
Range (min … max): 5.242 s … 5.490 s 10 runs
Summary
'target/release/ouch d linux.tar.gz -yo '/tmp/tmp.nhJZkRNvMD' > '/tmp/tmp.nhJZkRNvMD/log'' ran
1.14 ± 0.14 times faster than 'target/release/ouch d linux.tar.gz -yo '/tmp/tmp.nhJZkRNvMD''
This is the script I tested with, requires hyperfine
.
#!/bin/sh
set -e
cargo build --release
[ ! -f linux.tar.gz ] && curl https://github.com/torvalds/linux/archive/v5.14.tar.gz -Lo linux.tar.gz
out=$(mktemp -d)
target/release/ouch d linux.tar.gz -o "$out"
hyperfine --show-output \
"target/release/ouch d linux.tar.gz -yo '$out'" \
"target/release/ouch d linux.tar.gz -yo '$out' > '$out/log'"
rm -r "$out"
from ouch.
Interesting, it depends on the archive structure and level of compression, a 14%-ish speed improvement is not a huge priority right now, but I'll leave this open in case we want to optimize in the future.
from ouch.
should be fixed once #643 is solved.
from ouch.
Fixed! #643 was solved by #642 🎉
from ouch.
Related Issues (20)
- Ouch explodes when parallel decompression requires `stdin` interaction HOT 6
- Error message for `--format .tar.gz` outputs empty extension HOT 1
- Make support for format a feature
- Remove LZMA support
- Evaluate Profile-Guided Optimization (PGO) and LLVM BOLT
- Colored output for completed task HOT 1
- Add `list-formats` subcommand to show support-status of each format, with optional JSON output HOT 3
- Clarify that .sz refers to Google's Snappy format
- Supporting unrar introduces licensing issues
- The binary archives for the v0.5 release seem to actually be for a prerelease version HOT 3
- The "Dependencies" section of the README seems outdated. HOT 1
- Support for encrypted archives HOT 1
- publish to windows winget package manager HOT 2
- Add `iso` format HOT 3
- Support "zst" and "zstd" for ZStandard HOT 6
- Does ouch support permissions like `--xattrs`? HOT 4
- progress indicator HOT 19
- Request: Add Depth Option to `--tree` for Listing Archive Contents HOT 2
- Run logging IO in a separate thread (improve multithread capabilities)
- Add symbol to represent the directory name HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ouch.