Skip to content

SS-5 Add verb-based SMTP parser dispatch#280

Closed
vhafdal wants to merge 1 commit into
cosullivan:masterfrom
vhafdal:ss-5-parser-dispatch
Closed

SS-5 Add verb-based SMTP parser dispatch#280
vhafdal wants to merge 1 commit into
cosullivan:masterfrom
vhafdal:ss-5-parser-dispatch

Conversation

@vhafdal

@vhafdal vhafdal commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Dispatch SmtpParser.TryMake by the first command verb instead of trying every command parser in sequence.
  • Preserve existing command-specific parser methods and command factory creation behavior.
  • Add top-level dispatch tests across supported verbs and unknown command behavior.
  • Add SmtpParserBenchmarks and switch the benchmark runner to BenchmarkSwitcher for targeted runs.

Verification

  • DOTNET_ROLL_FORWARD=Major dotnet test src/SmtpServer.Tests/SmtpServer.Tests.csproj
    • Passed: 128, Skipped: 1
  • DOTNET_ROLL_FORWARD=Major dotnet build src/SmtpServer.Benchmarks/SmtpServer.Benchmarks.csproj
    • Passed with existing MailKit NU1902 advisory warning
  • DOTNET_ROLL_FORWARD=Major dotnet run -c Release --project src/SmtpServer.Benchmarks/SmtpServer.Benchmarks.csproj -- --filter *SmtpParserBenchmarks*

Benchmark Notes

ShortRun parser benchmark on .NET 9.0.17:

  • Unknown command: 1,013.37 ns -> 37.90 ns, allocation 1856 B -> 64 B
  • AUTH: 1,959.90 ns -> 1,093.24 ns, allocation 4368 B -> 2960 B
  • MAIL: 1,325.70 ns -> 1,099.03 ns, allocation 2528 B -> 2336 B
  • RCPT: 922.43 ns -> 627.18 ns, allocation 1560 B -> 1240 B
  • PROXY: 2,658.60 ns -> 1,662.89 ns, allocation 4984 B -> 3384 B
  • EHLO remains effectively neutral: 287.07 ns -> 285.70 ns

@vhafdal

vhafdal commented Jul 15, 2026

Copy link
Copy Markdown
Author

Superseded by consolidated PR #284.

@vhafdal vhafdal closed this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant