@@ -59,6 +59,41 @@ Write-Host "Parsing benchmark results..." -ForegroundColor Cyan
5959$csv = Import-Csv $ResultsFile
6060$currentDate = Get-Date - Format ' yyyy-MM-dd'
6161
62+ # Group benchmarks by operation type (Command, Query, Event/Publish, QueryWithDependencies)
63+ $groups = @ {
64+ ' Command' = @ ()
65+ ' Query' = @ ()
66+ ' Publish' = @ ()
67+ ' QueryWithDependencies' = @ ()
68+ }
69+
70+ # Define the order of implementations
71+ $implOrder = @ (' Direct' , ' Foundatio' , ' MediatR' , ' MassTransit' )
72+
73+ foreach ($row in $csv ) {
74+ $method = $row.Method
75+ if ($method -match ' QueryWithDependencies' ) {
76+ $groups [' QueryWithDependencies' ] += $row
77+ } elseif ($method -match ' Command' ) {
78+ $groups [' Command' ] += $row
79+ } elseif ($method -match ' Query' ) {
80+ $groups [' Query' ] += $row
81+ } elseif ($method -match ' Publish|Event' ) {
82+ $groups [' Publish' ] += $row
83+ }
84+ }
85+
86+ # Sort each group by implementation order
87+ foreach ($key in $groups.Keys ) {
88+ $groups [$key ] = $groups [$key ] | Sort-Object {
89+ $method = $_.Method
90+ for ($i = 0 ; $i -lt $implOrder.Count ; $i ++ ) {
91+ if ($method -match " ^$ ( $implOrder [$i ]) _" ) { return $i }
92+ }
93+ return 999
94+ }
95+ }
96+
6297# Build the markdown content
6398$markdown = @"
6499# Performance
@@ -68,13 +103,53 @@ Foundatio Mediator achieves near-direct call performance through C# interceptors
68103## Benchmark Results
69104
70105> 📊 **Last Updated:** $currentDate
71- > 🔧 **Generated automatically by [GitHub Actions](https://github.com/FoundatioFx/Foundatio.Mediator/actions/workflows/benchmarks.yml)**
106+
107+ ### Commands
72108
73109| Method | Mean | Allocated |
74110|:-------|-----:|----------:|
75111"@
76112
77- foreach ($row in $csv ) {
113+ foreach ($row in $groups [' Command' ]) {
114+ $markdown += " `n | $ ( $row.Method ) | $ ( $row.Mean ) | $ ( $row.Allocated ) |"
115+ }
116+
117+ $markdown += @"
118+
119+
120+ ### Queries
121+
122+ | Method | Mean | Allocated |
123+ |:-------|-----:|----------:|
124+ "@
125+
126+ foreach ($row in $groups [' Query' ]) {
127+ $markdown += " `n | $ ( $row.Method ) | $ ( $row.Mean ) | $ ( $row.Allocated ) |"
128+ }
129+
130+ $markdown += @"
131+
132+
133+ ### Events (Publish)
134+
135+ | Method | Mean | Allocated |
136+ |:-------|-----:|----------:|
137+ "@
138+
139+ foreach ($row in $groups [' Publish' ]) {
140+ $markdown += " `n | $ ( $row.Method ) | $ ( $row.Mean ) | $ ( $row.Allocated ) |"
141+ }
142+
143+ $markdown += @"
144+
145+
146+ ### Queries with Dependencies
147+
148+ | Method | Mean | Allocated |
149+ |:-------|-----:|----------:|
150+ "@
151+
152+ foreach ($row in $groups [' QueryWithDependencies' ]) {
78153 $markdown += " `n | $ ( $row.Method ) | $ ( $row.Mean ) | $ ( $row.Allocated ) |"
79154}
80155
0 commit comments