Skip to content

Add performance tests to CI with native PowerShell support#73

Merged
supervoidcoder merged 5 commits intomainfrom
copilot/add-performance-tests-ci
Feb 6, 2026
Merged

Add performance tests to CI with native PowerShell support#73
supervoidcoder merged 5 commits intomainfrom
copilot/add-performance-tests-ci

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Plan: Add Performance Tests to CI

  • Explore repository structure and understand current test setup
  • Update CI workflow to run both .bat and .ps1 test files directly
  • Fix typo in performance test file name (stess -> stress)
  • Update performance test to work with CI environment paths
  • Add performance tests for common operations (help, version, pid lookup, process info)
  • Address code review feedback (remove nested PowerShell, add validation)
  • Run security checks (no vulnerabilities found)
  • Remove redundant .bat wrapper to avoid duplicate execution
  • Add 100-iteration PID lookup performance test
  • Update 100-iteration test to use process name instead of --pid flag

Summary

Successfully added comprehensive performance testing to the CI pipeline:

Changes Made:

  1. Updated CI workflow (.github/workflows/build.yml):

    • Now runs .ps1 files directly (not .bat files)
    • Added proper error handling for all test runs
    • Optimized to avoid unnecessary nested PowerShell invocations
  2. Fixed existing stress test:

    • Fixed filename typo: stess_nested_shells.batstress_nested_shells.bat
    • Removed hardcoded paths for better portability
    • Added validation to ensure win-witr.exe is accessible
    • Removed .bat wrapper to prevent duplicate execution (saves ~30 seconds in CI)
  3. Created 5 new performance tests:

    • perf_help.ps1 - Measures help command performance
    • perf_version.ps1 - Measures version command performance
    • perf_self_lookup.ps1 - Measures process name lookup (5-run average)
    • perf_pid_lookup.ps1 - Measures PID lookup (5-run average)
    • perf_pid_100runs.ps1 - Runs process name lookup 100 times showing TotalMilliseconds for each iteration

All performance tests use PowerShell's Measure-Command cmdlet and report timing in TotalMilliseconds format as requested.

Original prompt

This section details on the original issue you should resolve

<issue_title>performance tests</issue_title>
<issue_description>we need to add performance tests to the ci too to measure how much stuff takes alongside the functionality tests. if it's easier allow the tests to run powershell files too

TotalMilliseconds</issue_description>

<agent_instructions>maybe use measure-command </agent_instructions>

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 6, 2026 17:21
- Update CI workflow to run both .bat and .ps1 test files
- Fix typo: stess -> stress in filename
- Update stress test to use relative paths instead of hardcoded paths
- Add performance tests for help, version, self-lookup, and PID lookup operations
- All performance tests output timing in TotalMilliseconds format

Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
- Remove unnecessary nested PowerShell invocation in CI
- Add validation to check win-witr.exe exists before running stress test

Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
Copilot AI changed the title [WIP] Add performance tests to CI for measurement Add performance tests to CI with native PowerShell support Feb 6, 2026
Copilot AI requested a review from supervoidcoder February 6, 2026 17:24
@supervoidcoder supervoidcoder marked this pull request as ready for review February 6, 2026 17:25
Copy link
Owner

@supervoidcoder supervoidcoder left a comment

Choose a reason for hiding this comment

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

also can you do one tha'ts like
1..100 | ForEach-Object { Measure-Command { .\win-witr --pid 17388 } | Select-Object TotalMilliseconds }

Copy link
Owner

Choose a reason for hiding this comment

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

since build.yml can run ps1 files now, the .bat file is kind of unnecessary since it was just a wrapper. now it will run both which will make workflows 30 seconds slower

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 97b4fd2 - removed the .bat wrapper since CI now runs .ps1 files directly.

- Remove stress_nested_shells.bat to avoid duplicate test execution
- Add perf_pid_100runs.ps1 with 100 iterations of PID lookup showing TotalMilliseconds

Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 6, 2026

also can you do one tha'ts like
1..100 | ForEach-Object { Measure-Command { .\win-witr --pid 17388 } | Select-Object TotalMilliseconds }

Added in 97b4fd2 - created perf_pid_100runs.ps1 that runs win-witr --pid 100 times and outputs TotalMilliseconds for each iteration.

Copy link
Owner

@supervoidcoder supervoidcoder left a comment

Choose a reason for hiding this comment

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

just nitpicking ⛏️⛏️⛏️⛏️⛏️⛏️⛏️⛏️⛏️⛏️ :copilot:

Copy link
Owner

Choose a reason for hiding this comment

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

you don't need to use the pid i just meant to use like the 100 iterations things but you should use the name way which can automatically get the pid for you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in cb8dac4 - now uses win-witr win-witr.exe which automatically finds the PID by process name.

- Change perf_pid_100runs.ps1 to use 'win-witr win-witr.exe' instead of '--pid'
- This automatically finds the PID by process name, simplifying the test

Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
@supervoidcoder
Copy link
Owner

@coderabbitai this is so tuff i think it's ready 🔥🔥🔥

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Tip

For best results, initiate chat on the files or code changes.

@supervoidcoder That's awesome! 🎉 The performance testing additions look comprehensive - you've added 5 new performance tests, optimized the CI workflow, and made some smart improvements like removing the redundant .bat wrapper.

Would you like me to:

  • Review the changes one more time?
  • Approve the PR if everything looks good to you?

Just let me know! 🚀


🐰✨
Happy rabbit with performance metrics!

  (\(\
  (=^.^=)
  (")_(")

🧠 Learnings used
Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 48
File: README.md:38-38
Timestamp: 2026-01-21T01:52:33.870Z
Learning: For supervoidcoder's README files in the win-witr repository: The user prefers an intentionally informal, humorous tone with casual language. Grammar formality suggestions (like "anyways" vs "anyway") should be skipped as they don't align with the intentional style of the documentation.

Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 58
File: main.cpp:380-400
Timestamp: 2026-01-29T22:00:51.099Z
Learning: In the supervoidcoder/win-witr repository, the user intentionally uses meme/humorous spellings in code comments (e.g., "vroken" instead of "broken") as part of an informal coding style. These should not be flagged as typos.

Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 0
File: :0-0
Timestamp: 2026-01-31T00:41:32.010Z
Learning: In the supervoidcoder/win-witr repository, the stress test at `tests/performance/stress_nested_shells.ps1` successfully validates the O(n) process tree walking algorithm by creating 100-level deep alternating PowerShell/CMD process chains and measuring performance. The test consistently completes in ~248ms for 100-level deep trees, confirming the performance optimization from the earlier O(n²) → O(n) refactoring.

Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 0
File: :0-0
Timestamp: 2026-01-30T01:58:35.174Z
Learning: In the supervoidcoder/win-witr repository, the user optimized the process tree walking algorithm from O(n²) to O(n) by taking a single CreateToolhelp32Snapshot at the start instead of creating a new snapshot for each level. This resulted in a ~4x performance improvement (from ~1000ms to ~248ms for 100-level deep trees). The optimization is validated by automated stress tests in CI that create 100-level deep alternating PowerShell/CMD process chains.

Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 60
File: .github/workflows/build.yml:75-80
Timestamp: 2026-02-03T04:17:02.875Z
Learning: In supervoidcoder/win-witr, some batch test files in tests/ are designed to test error cases (e.g., `win-witr System` testing that the System pseudo-process correctly fails because it has no executable path or command line). These tests intentionally exit with non-zero codes, so the CI workflow does not check $LASTEXITCODE after running tests to avoid breaking CI on expected failures.

Copy link
Owner

@supervoidcoder supervoidcoder left a comment

Choose a reason for hiding this comment

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

lgtm 👍 :copilot: :shipit: :fishsticks:

@supervoidcoder supervoidcoder merged commit d5896f4 into main Feb 6, 2026
10 checks passed
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.

performance tests

2 participants