MCPcopy Create free account
hub / github.com/bodgit/sevenzip / benchmarkArchive

Function benchmarkArchive

reader_test.go:567–594  ·  view source on GitHub ↗
(b *testing.B, file, password string, optimised bool)

Source from the content-addressed store, hash-verified

565}
566
567func benchmarkArchive(b *testing.B, file, password string, optimised bool) {
568 b.Helper()
569
570 h := crc32.NewIEEE()
571
572 for range b.N {
573 r, err := sevenzip.OpenReaderWithPassword(filepath.Join("testdata", file), password)
574 if err != nil {
575 b.Fatal(err)
576 }
577
578 var once sync.Once
579
580 f := func() {
581 if err := r.Close(); err != nil {
582 b.Fatal(err)
583 }
584 }
585
586 defer once.Do(f)
587
588 if err := extractArchive(b, &r.Reader, -1, h, reader, optimised); err != nil {
589 b.Fatal(err)
590 }
591
592 once.Do(f)
593 }
594}
595
596func BenchmarkAES7z(b *testing.B) {
597 benchmarkArchive(b, "aes7z.7z", testPassword, true)

Callers 15

BenchmarkAES7zFunction · 0.85
BenchmarkBzip2Function · 0.85
BenchmarkCopyFunction · 0.85
BenchmarkDeflateFunction · 0.85
BenchmarkDeltaFunction · 0.85
BenchmarkLZMAFunction · 0.85
BenchmarkLZMA2Function · 0.85
BenchmarkBCJ2Function · 0.85
BenchmarkComplexFunction · 0.85
BenchmarkLZ4Function · 0.85
BenchmarkBrotliFunction · 0.85
BenchmarkZstandardFunction · 0.85

Calls 3

OpenReaderWithPasswordFunction · 0.92
extractArchiveFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…