Conversation
… string interpolation Agent-Logs-Url: https://github.com/hibri/HttpMock/sessions/0c587fbf-086a-44c4-89e8-15fc96b56d3b Co-authored-by: hibri <122442+hibri@users.noreply.github.com>
…, BufferedBody.Length Agent-Logs-Url: https://github.com/hibri/HttpMock/sessions/0c587fbf-086a-44c4-89e8-15fc96b56d3b Co-authored-by: hibri <122442+hibri@users.noreply.github.com>
…d dictionary Agent-Logs-Url: https://github.com/hibri/HttpMock/sessions/0c587fbf-086a-44c4-89e8-15fc96b56d3b Co-authored-by: hibri <122442+hibri@users.noreply.github.com>
…ck in HttpServerFactory Agent-Logs-Url: https://github.com/hibri/HttpMock/sessions/0c587fbf-086a-44c4-89e8-15fc96b56d3b Co-authored-by: hibri <122442+hibri@users.noreply.github.com>
…Async Agent-Logs-Url: https://github.com/hibri/HttpMock/sessions/0c587fbf-086a-44c4-89e8-15fc96b56d3b Co-authored-by: hibri <122442+hibri@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
hibri
April 22, 2026 19:46
View session
Owner
|
@copilot resolve the merge conflicts in this pull request |
hibri
approved these changes
Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Systematic performance audit and fixes across the HttpMock request pipeline, targeting allocations and CPU work on every request.
Critical — per-request regex and I/O
EndpointMatchingRule.MatchPathwas constructing a newRegexfor every handler×request match attempt. Now cached in astatic ConcurrentDictionary<string, Regex>withRegexOptions.Compiled.static readonly; singleMatch()replacesIsMatch()+Match(). File reads now seek to offset instead of allocating the entire file into memory.IRequestProcessor.OnRequestreturnsTask; body reading usesReadToEndAsync.HttpServerlistener loop usesGetContextAsync(), removing the dedicatedThread.High — hot-path allocation reduction
TryGetValueO(1) lookup with case-insensitive fallback replaces O(H×R).Any()scan.foreachwith early exit replaces three chained.Where()+FirstOrDefault()._handlers.Count()(LINQ, O(n)) →.Count(O(1))header.Key.ToLowerInvariant()→string.Equals(..., OrdinalIgnoreCase)new byte[0]→Array.Empty<byte>()IsEnabled(LogLevel.Debug)to avoidSanitizeForLogallocationsDictionaryinHandleContextusing header countThreading
BuildServer()(which callsStart()+ TCP polling) now runs outside_serverLock.HandleContextAsyncgets.ContinueWith(OnlyOnFaulted)error handler.Breaking change
IRequestProcessor.OnRequestsignature changed fromvoidtoTask. Unit tests updated toasync Taskaccordingly.