Add System.Diagnostics.Process output-reading benchmarks#5152
Open
Add System.Diagnostics.Process output-reading benchmarks#5152
Conversation
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
adamsitnik
March 17, 2026 09:11
View session
adamsitnik
reviewed
Mar 17, 2026
Member
adamsitnik
left a comment
There was a problem hiding this comment.
@copilot please address my feedback
src/benchmarks/micro/libraries/System.Diagnostics/Perf_Process.cs
Outdated
Show resolved
Hide resolved
src/benchmarks/micro/libraries/System.Diagnostics/Perf_Process.cs
Outdated
Show resolved
Hide resolved
src/benchmarks/micro/libraries/System.Diagnostics/Perf_Process.cs
Outdated
Show resolved
Hide resolved
src/benchmarks/micro/libraries/System.Diagnostics/Perf_Process.cs
Outdated
Show resolved
Hide resolved
…sync Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Contributor
Author
adamsitnik
approved these changes
Mar 17, 2026
Member
adamsitnik
left a comment
There was a problem hiding this comment.
LGTM assuming the CI is going to be green
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.
Extends
Perf_Processwith three benchmarks that measure reading standard output from a child process echoing 1000 lines.New benchmarks:
ReadOutputLineByLine— event-driven viaOutputDataReceived+BeginOutputReadLine(); handler removed after exitReadOutputToEndAsync—_ = await StandardOutput.ReadToEndAsync()+await process.WaitForExitAsync();#if NETgated (not available on Full Framework)ReadOutputToEnd— synchronous_ = process.StandardOutput.ReadToEnd()Shared setup:
s_outputStartInfo:cmd /c for /L %i in (1,1,1000) do @echo Line %ion Windows,sh -c "for i in $(seq 1 1000); do echo Line $i; done"on Unix;RedirectStandardOutput=true,UseShellExecute=falses_ignoreOutputLine:static readonly DataReceivedEventHandlerwith astaticlambda — avoids per-iteration delegate allocation and closure inReadOutputLineByLineResults are explicitly discarded via
_ =to prevent potential dead code elimination. The async benchmark usesawait process.WaitForExitAsync()to avoid mixing sync and async code.📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.