From 621d99444cd3672a7c7dde4fa8b175c5866d4b1f Mon Sep 17 00:00:00 2001 From: Yusuf Birader Date: Wed, 6 Sep 2023 23:19:46 +0100 Subject: [PATCH] update README --- README.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2e9a4ae..0e6c8d7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ To install pzip, run `brew install pzip` [TODO: Add brew package] You can also use pzip as a library by importing the go package: ``` -go get github.com/ybirader/pzip +go install github.com/ybirader/pzip ``` ### Usage @@ -38,20 +38,46 @@ if err != nil { } defer archiver.Close() -dirPath := "./hello" +files := []string{ "./hello", "./hello.txt", "./bye.md" } -err = archiver.ArchiveDir(dirPath) +err = archiver.Archive(context.Background(), files) if err != nil { log.Fatal(err) } +``` + + +### Benchmarks + +We use Matt Mahoney's [sample directory](https://mattmahoney.net/dc/10gb.html) in our benchmark + +Using the standard `zip` utlity found on most *nix systems, we get the following time to archive: +``` +real 14m31.809s +user 13m12.833s +sys 0m24.193s +``` + +The size of the resulting archive is 4.51 GB + +Running the same benchmark with pzip, we find that: -files := []string{"./hello.txt", "./bye.md"} -archiver.ArchiveFiles(files...) ``` +goos: darwin +goarch: amd64 +pkg: github.com/pzip/cmd/cli +cpu: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz +BenchmarkPzip-8 1 81600764936 ns/op 7928 B/op 32 allocs/op +PASS +ok github.com/pzip/cmd/cli 83.847s +``` + +The size of the resulting zip was slightly larger at: 4.62 GB. + +Overall, this is over 10x faster! And this is with no optimizations for memory etc. Upcoming features: -- add context to gracefully stop archiving midway - add flag to maintain unix file permissions i.e. mode of original file - add support for symbolic links - add flag to support skipping compression i.e. --skip-suffixes