Measure the parse, validate and format phases separately - #378
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #378 +/- ##
=======================================
Coverage 98.01% 98.01%
=======================================
Files 39 39
Lines 52818 52818
Branches 1105 1105
=======================================
Hits 51770 51770
Misses 795 795
Partials 253 253 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
twcclegg
force-pushed
the
test/benchmark-phases
branch
from
August 5, 2026 22:10
f342a6d to
209e4a3
Compare
📊 Benchmark Results
PR branch
PR base
|
This was referenced Aug 14, 2026
Closed
Closed
This was referenced Aug 23, 2026
Closed
Closed
This was referenced Sep 1, 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.
ParseValidateAndFormatPhoneNumbersmeasures all three phases together, so the ~580 B allocated pernumber is a total with no attribution — and the two candidates want opposite fixes: Parse allocates
through StringBuilder round trips, Format through a regex replacement chain that produces a fresh
string per step.
Adds
ParseOnly,ValidateOnlyandFormatOnlyover the same data, pre-parsed in setup so the lasttwo measure only their own work.
FormatOnlyusesINTERNATIONALbecauseE164takes an early exitthat skips pattern formatting entirely.
The end-to-end benchmark stays — parsing warms metadata the later phases reuse, so the whole isn't the
sum. All four share the existing class, since BenchmarkDotNet builds a project per class (~20s).
Lands separately from the optimisation: the comparison runs the base commit's suite, so a benchmark
added alongside the change it measures reports nothing.