MCPcopy Create free account
hub / github.com/foxcpp/maddy / BenchmarkMsgPipelineTargets

Function BenchmarkMsgPipelineTargets

internal/msgpipeline/bench_test.go:73–98  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

71}
72
73func BenchmarkMsgPipelineTargets(b *testing.B) {
74 testWithCount := func(targetCount int) {
75 b.Run(strconv.Itoa(targetCount), func(b *testing.B) {
76 targets := make([]module.DeliveryTarget, 0, targetCount)
77 for i := 0; i < targetCount; i++ {
78 targets = append(targets, &testutils.Target{InstName: "target_" + strconv.Itoa(i), DiscardMessages: true})
79 }
80
81 d := MsgPipeline{msgpipelineCfg: msgpipelineCfg{
82 perSource: map[string]sourceBlock{},
83 defaultSource: sourceBlock{
84 perRcpt: map[string]*rcptBlock{},
85 defaultRcpt: &rcptBlock{
86 targets: targets,
87 },
88 },
89 }}
90
91 testutils.BenchDelivery(b, &d, "sender@example.org", []string{"rcpt-X@example.org"})
92 })
93 }
94
95 testWithCount(5)
96 testWithCount(10)
97 testWithCount(15)
98}

Callers

nothing calls this directly

Calls 2

BenchDeliveryFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected