[MTP] Improve performance of validating command line options#5655
Draft
[MTP] Improve performance of validating command line options#5655
Conversation
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [MTP] Improve performance of validating command line options
[MTP] Improve performance of validating command line options
May 27, 2025
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Show resolved
Hide resolved
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Show resolved
Hide resolved
Youssef1313
reviewed
May 27, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Show resolved
Hide resolved
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
Youssef1313
reviewed
Jun 1, 2025
src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOptionsValidator.cs
Outdated
Show resolved
Hide resolved
…tation Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. |
…thod Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5655 +/- ##
==========================================
- Coverage 76.37% 76.32% -0.05%
==========================================
Files 602 602
Lines 36759 36813 +54
==========================================
+ Hits 28075 28099 +24
- Misses 8684 8714 +30
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
This PR improves the performance of
CommandLineOptionsValidatorwhich was consuming an unnecessarily large amount of CPU time as identified in a trace involving multiple test processes.Performance improvements:
Algorithm Optimizations
ValidateNoUnknownOptionsby using a HashSet for O(1) lookups instead of nested LINQ operationsMemory Allocations
ToTrimmedStringto avoid unnecessary string allocationsData Structure Improvements
Union()andIntersect()operations with direct dictionary operationsDocumentation
PerformanceSensitiveattribute to document performance-critical code pathsBefore Optimization
Fixes #5651.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.