DamianEdwards / DamianEdwards/MiniValidation
Optimize the string allocations
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 390
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
The validator has to allocate strings for each field it validates, including adding a level prefix as it descends the object graph, even if there don't end up being any errors. Would be good to look at if there's a way to minimize these allocations.
Examples:
- https://github.com/DamianEdwards/MiniValidation/blob/7efcac2e2b82fd5c69f9be1a1b4587032afe9a2e/src/MiniValidation/MiniValidator.cs#L185
- https://github.com/DamianEdwards/MiniValidation/blob/7efcac2e2b82fd5c69f9be1a1b4587032afe9a2e/src/MiniValidation/MiniValidator.cs#L190
- https://github.com/DamianEdwards/MiniValidation/blob/7efcac2e2b82fd5c69f9be1a1b4587032afe9a2e/src/MiniValidation/MiniValidator.cs#L247
- https://github.com/DamianEdwards/MiniValidation/blob/7efcac2e2b82fd5c69f9be1a1b4587032afe9a2e/src/MiniValidation/MiniValidator.cs#L288
- https://github.com/DamianEdwards/MiniValidation/blob/7efcac2e2b82fd5c69f9be1a1b4587032afe9a2e/src/MiniValidation/MiniValidator.cs#L324
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/MiniValidation/MiniValidator.cs at the referenced lines 185, 190, 247, 288, and 324. Trace how validation builds field paths and measure allocations before and after any focused change; done means preserving validation behavior while reducing unnecessary string allocations, with the relevant test suite still passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100