Skip to content

Commit

Permalink
test: initial benchmark for ls
Browse files Browse the repository at this point in the history
# Motivation

To reduce the risk of performance regressions, we
should have a benchmark for `ls`.
  • Loading branch information
trym-b committed Apr 2, 2024
1 parent fdd8681 commit 855fc2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/ls/ls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ func TestConfigReadFileWithError(t *testing.T) {
_ = config.readFile(afero.NewOsFs(), warcWithErrors)
// TODO: check that the result contains the expected values
}

func BenchmarkReadFileWithError(b *testing.B) {
testDataDir := filepath.Join("..", "..", "test-data")
warcWithErrors := filepath.Join(testDataDir, "samsung-with-error", "rec-33318048d933-20240317162652059-0.warc.gz")
config := &conf{}
config.filter = filter.NewFromViper()
config.files = []string{warcWithErrors}
for i := 0; i < b.N; i++ {
_ = config.readFile(afero.NewOsFs(), warcWithErrors)
}
}

0 comments on commit 855fc2d

Please sign in to comment.