MCPcopy
hub / github.com/klauspost/compress / BenchmarkReaderManyShallowFiles

Function BenchmarkReaderManyShallowFiles

zip/reader_test.go:1892–1916  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1890}
1891
1892func BenchmarkReaderManyShallowFiles(b *testing.B) {
1893 var buf bytes.Buffer
1894 zw := NewWriter(&buf)
1895
1896 for i := range 310000 {
1897 name := fmt.Sprintf("%v", i)
1898 zw.CreateHeader(&FileHeader{
1899 Name: name,
1900 Method: Store,
1901 })
1902 }
1903
1904 if err := zw.Close(); err != nil {
1905 b.Fatal(err)
1906 }
1907 data := buf.Bytes()
1908
1909 for range b.N {
1910 zr, err := NewReader(bytes.NewReader(data), int64(len(data)))
1911 if err != nil {
1912 b.Fatal(err)
1913 }
1914 zr.Open("does-not-exist")
1915 }
1916}
1917
1918// TestNameDecoder verifies that a NameDecoder passed via ReaderOptions may
1919// rewrite Name and Comment before UTF-8 detection runs.

Callers

nothing calls this directly

Calls 7

CreateHeaderMethod · 0.95
CloseMethod · 0.95
OpenMethod · 0.95
FatalMethod · 0.80
NewWriterFunction · 0.70
NewReaderFunction · 0.70
BytesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…