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

Function BenchmarkMsgPipelineGlobalChecks

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

Source from the content-addressed store, hash-verified

42}
43
44func BenchmarkMsgPipelineGlobalChecks(b *testing.B) {
45 testWithCount := func(checksCount int) {
46 b.Run(strconv.Itoa(checksCount), func(b *testing.B) {
47 checks := make([]module.Check, 0, checksCount)
48 for i := 0; i < checksCount; i++ {
49 checks = append(checks, &testutils.Check{InstName: "check_" + strconv.Itoa(i)})
50 }
51
52 target := testutils.Target{InstName: "test_target", DiscardMessages: true}
53 d := MsgPipeline{msgpipelineCfg: msgpipelineCfg{
54 globalChecks: checks,
55 perSource: map[string]sourceBlock{},
56 defaultSource: sourceBlock{
57 perRcpt: map[string]*rcptBlock{},
58 defaultRcpt: &rcptBlock{
59 targets: []module.DeliveryTarget{&target},
60 },
61 },
62 }}
63
64 testutils.BenchDelivery(b, &d, "sender@example.org", []string{"rcpt-X@example.org"})
65 })
66 }
67
68 testWithCount(5)
69 testWithCount(10)
70 testWithCount(15)
71}
72
73func BenchmarkMsgPipelineTargets(b *testing.B) {
74 testWithCount := func(targetCount int) {

Callers

nothing calls this directly

Calls 2

BenchDeliveryFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected