https://github.com/imarsman/rgzip
GZip in rust
https://github.com/imarsman/rgzip
Last synced: 26 days ago
JSON representation
GZip in rust
- Host: GitHub
- URL: https://github.com/imarsman/rgzip
- Owner: imarsman
- License: apache-2.0
- Created: 2021-09-12T03:01:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-13T20:05:07.000Z (over 3 years ago)
- Last Synced: 2025-02-17T05:11:18.443Z (4 months ago)
- Language: Rust
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rgzip
GZip in rustThis is my first Rust program and as such is not gong to be sophisticated. It is
intended to do the same things as my gogzip program. My goal is to compare the
pros and cons of Rust versus Go for this task. Rust seems like a pretty good fit
for commandline utilities but I get the feeling that Go is a lot more
confortable to use for things like web services and encryption with TLS
certificates.I'm finding error handling to be a bit of a learning experience. It looks to be
quite capable but seems to be using a different underlying philosophy than I'm
used to.I will be adding in some tests. Adding in modules is beyond the scope of this
project.## Arguments
* `rgzip -h` - print usage
* `rgzip ` - gzip a file and remove the original
* `rgzip -f ` - gzip a file and overwrite if it is there already
* `rgzip -k ` - gzip a file and do not remove the original
* `rgzip -c ` - gunzip a file to stdout## Usage
I will be adding testing.
To build with debugging
`cargo build`
output goes in `./target/debug/rgzip`
To build for release
`cargo build --release`
output goes in `./target/release/rgzip`
## Simple test to compare with gogzip
Golang gogzip is slightly slower than the Rust rgzip release build. Both are
slower than the built-in gzip.The Go version has more lines, but it also has more going on. In general,
though, the Rust version is a lot more concise. If the Rust version had the
extra logic added to it that exists in the Go version it would still likely be
half as many lines of code. This speaks I think partly to the languages
themselves and also I am sure, my programming.```
time for i in {1..1000}; do rgzip -k -f -i sample/*.txt; donereal 0m6.662s
user 0m3.735s
sys 0m1.848s
``````
$: time for i in {1..1000}; do gogzip -f -k sample/*.txt; donereal 0m8.141s
user 0m4.123s
sys 0m3.811s
```Here is the native one
```
$: time for i in {1..1000}; do gzip -f -k sample/*.txt; donereal 0m4.451s
user 0m1.428s
sys 0m2.852s
```