Skip to content

SS-7 Reduce AUTH and EHLO allocations - #282

Closed
vhafdal wants to merge 1 commit into
cosullivan:masterfrom
vhafdal:ss-7-auth-ehlo-allocation
Closed

SS-7 Reduce AUTH and EHLO allocations#282
vhafdal wants to merge 1 commit into
cosullivan:masterfrom
vhafdal:ss-7-auth-ehlo-allocation

Conversation

@vhafdal

@vhafdal vhafdal commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Stream EHLO response lines without materializing an intermediate array.
  • Replace AUTH PLAIN regex parsing with explicit NUL-delimited parsing over decoded bytes.
  • Use non-throwing base64 decode paths for AUTH PLAIN and LOGIN invalid inputs.
  • Emit a single authentication failure response for invalid AUTH PLAIN input.
  • Add raw SMTP tests for invalid AUTH base64 and stable EHLO output.
  • Add Auth/EHLO benchmarks and enable filtered benchmark runs.

Verification

  • DOTNET_ROLL_FORWARD=Major dotnet test src/SmtpServer.Tests/SmtpServer.Tests.csproj --no-restore
    • Passed: 121, 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 *AuthEhloBenchmarks*

Benchmark Notes

ShortRun on .NET 9.0.17:

  • EHLO: 311.9 ns, 528 B allocated
  • AUTH PLAIN: 327.8 ns, 248 B allocated
  • Invalid AUTH PLAIN: 239.0 ns, 136 B allocated

@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