Skip to content

docs: distinguish dispatch only figures from full per request cost - #3

Merged
HBartosch merged 1 commit into
mainfrom
docs/allocation-figure-clarity
Sep 29, 2026
Merged

HBartosch merged 1 commit into
mainfrom
docs/allocation-figure-clarity

Conversation

@HBartosch

Copy link
Copy Markdown
Owner

🚀 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 B while the README says
Routya Send, Singleton handler: 808 B. Both are correct, but nothing explained the eightfold
difference, 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

  • Request/notification handler logic
  • Pipeline behavior changes
  • Dispatcher performance or safety
  • DI registration improvements
  • Unit tests added or updated
  • Benchmarks updated (if performance-related)

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

  • Code compiles and passes unit tests
  • No breaking changes introduced (or documented)
  • Docs/readme updated if needed
  • Follows Routya code style and conventions
  • Scoped vs root resolution behavior remains correct

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_SUMMARY and running both suites, to
confirm the new labels read correctly in the table that appears on the workflow run page:

| Send, Singleton handler, dispatch only                      | 104 B | 128 B  |  24 B |
| PublishAsync, 2 Singleton handlers, dispatch only           |  32 B |  64 B  |  32 B |
| SendAsync, Scoped handler, includes dispatch scope          | 544 B | 640 B  |  96 B |
| PublishParallelAsync, 2 Scoped handlers, scope per handler  | 824 B | 1024 B | 200 B |

Verified the README's new claim against the benchmark source rather than assuming it:
Routya.Benchmark registers exactly two Routya pipeline behaviours and two equivalent MediatR
behaviours per provider, and each benchmark method calls CreateScope() and
GetRequiredService<IRoutya>() inside the measured region. So "the full cost of serving one
request" and "both libraries are measured the same way" are both accurate as written.

Automated, all run and passing:

Suite Tests
Routya.Test 64
Routya.SourceGenerators.Test 31
Routya.SourceGen.Test 23

💬 Additional Context

Why the two sets of figures differ

README table Allocation budget tests
Measures The whole cost of serving one request Dispatch on its own
Includes CreateScope(), GetRequiredService, two pipeline behaviours, the handler Dispatcher already resolved, no behaviours
Purpose Comparing libraries, so MediatR is measured identically Catching a regression, so Routya is isolated from the container
Singleton Send 808 B 104 B

Both units are the right one for their job. The problem was only that neither said so.

What changed

  • 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 states what its figures include, and states the relationship outright: a Singleton
    Send is 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.

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.
@HBartosch
HBartosch merged commit 3a96aa0 into main Sep 29, 2026
5 checks passed
@HBartosch
HBartosch deleted the docs/allocation-figure-clarity branch September 29, 2026 06:59
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