Skip to content

Commit

Permalink
add extractor benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ybirader committed Sep 22, 2023
1 parent 472c82a commit 809d099
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (

const (
benchmarkRoot = "testdata/benchmark"
benchmarkDir = "minibench" // modify this to match the file/directory you want to benchmark
benchmarkDir = "minibench" // modify this to match the file/directory you want to benchmark
benchmarkArchive = "miniextractbench.zip" // modify this to match archive you want to benchmark
testArchiveDirectoryName = "hello"
)

Expand Down Expand Up @@ -66,3 +67,17 @@ func BenchmarkArchiverCLI(b *testing.B) {
cli.Archive(context.Background())
}
}

// BenchmarkExtractorCLI benchmarks extracting an archive, referenced by benchmarkArchive
func BenchmarkExtractorCLI(b *testing.B) {
archivePath := filepath.Join(benchmarkRoot, benchmarkArchive)

cli := pzip.ExtractorCLI{archivePath, benchmarkRoot}

b.ReportAllocs()
b.ResetTimer()

for i := 0; i < b.N; i++ {
cli.Extract()
}
}

0 comments on commit 809d099

Please sign in to comment.