Repository navigation
docs: distinguish dispatch only figures from full per request cost - #3
Merged
Merged
Conversation
The CI job summary and the README both publish allocation figures under near identical labels, but they measure different things. The summary said "Send with a Singleton handler: 104 B" while the README said "Routya Send, Singleton handler: 808 B". Anyone comparing the two would reasonably conclude one of them was wrong. Both are correct and both are useful, for different purposes: - The budget tests measure dispatch on its own, with the dispatcher already resolved and no behaviours registered. That is the right unit for catching a regression, because it isolates Routya from the container - The README table is the whole cost of serving one request, including creating the DI scope, resolving the dispatcher and running two pipeline behaviours. That is the right unit for comparing libraries, and MediatR is measured the same way Neither said so. The budget test scenarios are now self describing, for example "Send, Singleton handler, dispatch only" and "PublishParallelAsync, 2 Scoped handlers, scope per handler", so the CI summary explains itself without reference to anything else. The README says what its figures include and states the relationship outright: a Singleton Send is 104 B of dispatch inside 808 B of total work. Also records what the first post merge CI run demonstrated. All nine allocation figures came back identical to the byte against measurements taken on a different machine and operating system. The README previously asserted that allocations hold on any hardware; it can now say that was verified independently, which is a materially stronger claim than the timings it replaced could ever make.
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.
🚀 Pull Request: Routya.Core
📋 Summary
The CI job summary and the README both publish allocation figures under near identical labels, but
they measure different things. The first post merge run reported
Send with a Singleton handler: 104 Bwhile the README saysRoutya Send, Singleton handler: 808 B. Both are correct, but nothing explained the eightfolddifference, so a reader comparing them would reasonably conclude one was wrong.
Documentation and test labels only. No behaviour, no published figure and no budget changes.
🔗 Related Issues (If Any)
Closes #___
Linked to: #___
🛠️ Changes Made
Only the test scenario label strings changed. No test logic, no assertions and no budgets were
touched, which the diff shows directly: every changed line in both test files is an
AssertWithinBudget(...)description argument.✅ Checklist
The last item is ticked on the basis that no dispatch code is touched by this branch and the full
suite passes unchanged, not because new scope testing was added.
🧪 Manual Testing Notes
Rendered the CI job summary locally by setting
GITHUB_STEP_SUMMARYand running both suites, toconfirm the new labels read correctly in the table that appears on the workflow run page:
Verified the README's new claim against the benchmark source rather than assuming it:
Routya.Benchmarkregisters exactly two Routya pipeline behaviours and two equivalent MediatRbehaviours per provider, and each benchmark method calls
CreateScope()andGetRequiredService<IRoutya>()inside the measured region. So "the full cost of serving onerequest" and "both libraries are measured the same way" are both accurate as written.
Automated, all run and passing:
Routya.TestRoutya.SourceGenerators.TestRoutya.SourceGen.Test💬 Additional Context
Why the two sets of figures differ
CreateScope(),GetRequiredService, two pipeline behaviours, the handlerSendBoth units are the right one for their job. The problem was only that neither said so.
What changed
Send, Singleton handler, dispatch onlyand
PublishParallelAsync, 2 Scoped handlers, scope per handler, so the CI summary explains itselfwithout reference to anything else.
Sendis 104 B of dispatch inside 808 B of total work.Strengthened claim, now evidenced
The README previously asserted that allocations "hold on your hardware as well as ours". The first
post merge CI run returned all nine figures identical to the byte against measurements taken on
a different machine and operating system, so the README now says that was verified independently
rather than asserting it. That is a materially stronger claim than the timings it replaced could
make: the MediatR baseline, running unchanged code, has been observed drifting by a third between
two runs on a single machine.