MCPcopy Index your code
hub / github.com/klauspost/compress / BenchmarkDecoderWithCustomFiles

Function BenchmarkDecoderWithCustomFiles

zstd/decoder_test.go:1793–1816  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1791}
1792
1793func BenchmarkDecoderWithCustomFiles(b *testing.B) {
1794 const info = "To run benchmark on custom .zst files, please place your files in subdirectory 'testdata/benchmark-custom'.\nEach file is tested in a separate benchmark, thus it is possible to select files with the standard command 'go test -bench BenchmarkDecoderWithCustomFiles/<pattern>."
1795
1796 const subdir = "testdata/benchmark-custom"
1797
1798 if _, err := os.Stat(subdir); os.IsNotExist(err) {
1799 b.Skip(info)
1800 }
1801
1802 files, err := filepath.Glob(filepath.Join(subdir, "*.zst"))
1803 if err != nil {
1804 b.Error(err)
1805 return
1806 }
1807
1808 if len(files) == 0 {
1809 b.Skip(info)
1810 }
1811
1812 for _, path := range files {
1813 name := filepath.Base(path)
1814 b.Run(name, func(b *testing.B) { benchmarkDecoderWithFile(path, b) })
1815 }
1816}
1817
1818func testDecoderDecodeAll(t *testing.T, fn string, dec *Decoder) {
1819 zr := testCreateZipReader(fn, t)

Callers

nothing calls this directly

Calls 4

benchmarkDecoderWithFileFunction · 0.85
SkipMethod · 0.80
StatMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…