You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set of general benchmarks for testing both different SDK versions, and also looking for improvements
2
+
3
+
## How to run
4
+
5
+
```bash
6
+
dotnet run -c Release -f net10.0
7
+
```
8
+
9
+
To run a specific benchmark:
10
+
11
+
```bash
12
+
dotnet run -c Release -f net10.0 -- --filter '*Serialize*'
13
+
dotnet run -c Release -f net10.0 -- --filter '*ParseMessage*'
14
+
```
15
+
16
+
## Baseline comparison
17
+
18
+
Each benchmark suite defines two jobs:
19
+
20
+
-**NuGet 3.7.2** (baseline) — runs against the published NuGet package
21
+
-**Local** — runs against the local source tree
22
+
23
+
This is controlled by the `HL7V2Version` MSBuild property in `Benchmarks.csproj`:
24
+
- When `HL7V2Version` is set (e.g. `/p:HL7V2Version=3.7.2`), the project references the specified NuGet package.
25
+
- When it is not set (the default for the Local job), the project references the local source directly via `ProjectReference`.
26
+
27
+
## What is being measured
28
+
29
+
### SerializeBench
30
+
31
+
Measures `Encode()` throughput during serialization. The main improvement is a fast-path in `HL7Encoding.Encode()`: `IndexOfAny` checks upfront whether the value contains any characters that need escaping, skipping the full scan when none are found. The special-character array is also cached and only rebuilt when a delimiter property changes (dirty flag).
32
+
33
+
### ParseMessageBench
34
+
35
+
Measures parse + field access throughput. Exercises both 2-component (`Segment.Field`) and 3-component (`Segment.Field.Component`) query paths, plus segment occurrence indexing (`NTE[1].3`). On .NET 7+, query validation uses `[GeneratedRegex]`-backed methods instead of repeated `Regex.Matches` calls with inline pattern strings.
0 commit comments