Reduce ServerMode notification allocations - #10670
Reduce ServerMode notification allocations#10670Amaury Levé (Evangelink) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Reduces ServerMode notification allocations while preserving serialization and aggregation behavior.
Changes:
- Replaces serializer LINQ projection with a capacity-sized list.
- Isolates the aggregator’s captured filtering predicate.
- Adds serialization and aggregation regression tests.
Show a summary per file
| File | Description |
|---|---|
SerializerUtilities.TestNodeSerializers.cs |
Optimizes change serialization. |
TestNodeStateChangeAggregator.cs |
Avoids closure allocation for non-terminal batches. |
FormatterUtilitiesTests.cs |
Tests serialization shape, typing, order, and null handling. |
TestNodeStateChangeAggregatorTests.cs |
Tests repeated aggregation behavior. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1f616dbd-edac-4ae9-b58a-b0d7b4739297
🧪 Expert test review — PR #10670
Summary: This PR refactors This advisory comment was generated automatically. Grades are heuristic
|
🧵 Parallel-safety audit — PR #10670Parallelization — one row per test assembly audited:
Findings: A (global-state) Nothing to flag. Both changed test files add pure, instance-scoped test methods with no cross-test coordination concerns:
No production-code changes in this PR ( Advisory only — heuristic, non-blocking. Re-run with
|
Summary
TestNodeStateChangedEventArgsarray LINQ projection with a capacity-sizedList<object>fill while preserving null/empty behavior and runtime collection typingPerformance
A standalone faithful-shape harness measured median time and allocation over null, empty, 1, 8, 128, and 1,024 item inputs on .NET 8 and .NET Framework 4.6.2.
The serializer percentages are intentionally omitted because the harness models the container work faithfully but uses a smaller per-item payload than production. .NET Framework allocation values are approximate because its counter is AppDomain-wide.
Validation
.\build.cmd -projects .\test\UnitTests\Microsoft.Testing.Platform.UnitTests\Microsoft.Testing.Platform.UnitTests.csproj -test -blPassed on
net8.0,net9.0, andnet462with 0 warnings and 0 errors.Closes #10669