Skip to content

Add Go benchmarks for process execution patterns#25

Merged
adamsitnik merged 12 commits intomainfrom
copilot/implement-process-benchmarks-go
Dec 11, 2025
Merged

Add Go benchmarks for process execution patterns#25
adamsitnik merged 12 commits intomainfrom
copilot/implement-process-benchmarks-go

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 11, 2025

Implementation Plan: Go Process Benchmarks

  • Study the existing C# benchmarks structure and functionality
  • Create a BenchmarksGo directory for Go benchmarks
  • Initialize Go module with appropriate dependencies
  • Implement NoRedirection benchmark (Execute without output redirection)
  • Implement Discard benchmark (Execute with output discarded)
  • Implement RedirectToFile benchmark (Execute with output to file)
  • Implement RedirectToPipe benchmark (Execute with piped output reading)
  • Add comprehensive documentation (README) for running Go benchmarks
  • Test all benchmarks to ensure they work correctly
  • Update main README with references to Go benchmarks
  • Fix race condition in discard benchmark
  • Address feedback: Change all commands to dotnet --help
  • Add exit code retrieval in all benchmarks
  • Move file cleanup outside benchmark timing
  • Add Windows/Unix OS detection for shell commands
  • Improve OS detection using runtime.GOOS
  • Add proper shell path quoting for security
  • Exclude setup (TempDir and filepath.Join) from benchmark timing
  • Document time unit display in benchmark output
  • Simplify time units documentation
  • Add comprehensive regex filtering examples for benchmark selection
  • Fix Windows compatibility by quoting dot in -bench flag
  • Clarify that Go has no native --export flag for benchmark results
  • Recommend running filtered benchmarks to avoid stdout mixing
  • Fix Windows shell redirection by converting backslashes to forward slashes
  • Final verification and cleanup
Original prompt

This section details on the original issue you should resolve

<issue_title>Implement Process benchmarks using golang</issue_title>
<issue_description>Study the C# benchmarks we have in https://github.com/adamsitnik/ProcessPlayground/tree/main/Benchmarks, implement their counterparts using the standard libraries in golang.

Add a short document that explains how to run these benchmarks following all the best practices (like run in Release mode etc). Assume the reader is not familiar with go.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI self-assigned this Dec 11, 2025
Copilot AI and others added 3 commits December 11, 2025 13:19
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement process benchmarks using Golang Add Go benchmarks for process execution patterns Dec 11, 2025
Copilot AI requested a review from adamsitnik December 11, 2025 13:26
Copy link
Copy Markdown
Owner

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please address my feedback

Comment thread BenchmarksGo/discard_test.go Outdated
Comment thread BenchmarksGo/discard_test.go
Comment thread BenchmarksGo/main.go
Comment thread BenchmarksGo/redirect_to_file_test.go
Comment thread BenchmarksGo/redirect_to_file_test.go Outdated
Copilot AI and others added 2 commits December 11, 2025 13:46
…anup timing, add Windows support

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copy link
Copy Markdown
Owner

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's almost ready, @copilot please address my feedback regarding excluding benchmark setup from the reported time

Comment thread BenchmarksGo/redirect_to_file_test.go
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Comment thread BenchmarksGo/README.md Outdated
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Comment thread BenchmarksGo/README.md Outdated
Comment thread BenchmarksGo/README.md Outdated
…xamples

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI requested a review from adamsitnik December 11, 2025 15:06
Copy link
Copy Markdown
Owner

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot PTAL at my feedback

Comment thread BenchmarksGo/README.md Outdated
Comment thread BenchmarksGo/README.md
…s documentation

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Comment thread BenchmarksGo/README.md Outdated
Comment thread BenchmarksGo/README.md Outdated
… filtering benchmarks

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Comment thread BenchmarksGo/redirect_to_file_test.go Outdated
…ashes

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Comment on lines +109 to +110
windowsPath := strings.ReplaceAll(filePath, "\\", "/")
cmdStr := "dotnet --help > \"" + windowsPath + "\""
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot it still fails on Windows, but I can merge it as is and you can send a follow PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged. The Windows shell redirection issue can be addressed in a follow-up PR. The benchmark might need additional investigation on Windows to determine the root cause (possibly related to how cmd.exe handles the redirection syntax with paths containing spaces or special characters, or potential issues with the dotnet command availability/PATH configuration on the test system).

@adamsitnik adamsitnik marked this pull request as ready for review December 11, 2025 16:43
@adamsitnik adamsitnik merged commit 64b48d5 into main Dec 11, 2025
1 check failed
Copilot AI requested a review from adamsitnik December 11, 2025 16:44
@adamsitnik adamsitnik deleted the copilot/implement-process-benchmarks-go branch December 11, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Process benchmarks using golang

2 participants