MCPcopy Create free account
hub / github.com/AdRoll/baker / BenchmarkFilesOutput

Function BenchmarkFilesOutput

output/bench_test.go:14–58  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

12)
13
14func BenchmarkFilesOutput(b *testing.B) {
15 defer testutil.DisableLogging()()
16 dir, rmdir := testutil.TempDir(b)
17 defer rmdir()
18
19 toml := fmt.Sprintf(`
20 [input]
21 name="Random"
22 [input.config]
23 numlines = 10000
24
25 [output]
26 name="FileWriter"
27 procs=1
28
29 [output.config]
30 pathstring = "%s"
31 zstdcompressionlevel = 0
32 `, filepath.Join(dir, "log.zst"))
33
34 c := baker.Components{
35 Inputs: []baker.InputDesc{inputtest.RandomDesc},
36 Outputs: []baker.OutputDesc{FileWriterDesc},
37 }
38
39 cfg, err := baker.NewConfigFromToml(strings.NewReader(toml), c)
40 if err != nil {
41 b.Fatal(err)
42 }
43
44 b.ReportAllocs()
45 b.ResetTimer()
46
47 for n := 0; n < b.N; n++ {
48 b.StopTimer()
49 topology, err := baker.NewTopologyFromConfig(cfg)
50 if err != nil {
51 b.Fatal(err)
52 }
53 b.StartTimer()
54 topology.Start()
55 topology.Wait()
56 topology.Stop()
57 }
58}

Callers

nothing calls this directly

Calls 7

DisableLoggingFunction · 0.92
TempDirFunction · 0.92
NewConfigFromTomlFunction · 0.92
NewTopologyFromConfigFunction · 0.92
StopMethod · 0.65
StartMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected