-
Notifications
You must be signed in to change notification settings - Fork 0
Add performance tests to CI with native PowerShell support #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cb16862
Initial plan
Copilot 52eca5a
Add performance tests to CI and create additional perf tests
Copilot 8288aba
Address code review feedback
Copilot 97b4fd2
Remove redundant .bat wrapper and add 100-iteration PID test
Copilot cb8dac4
Use process name lookup instead of --pid flag in 100-iteration test
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Performance test for help command | ||
| # Measures time taken to display help information | ||
|
|
||
| Write-Host "Testing help command performance..." -ForegroundColor Yellow | ||
|
|
||
| # Warm-up run | ||
| & win-witr --help | Out-Null | ||
|
|
||
| # Measure performance | ||
| $result = Measure-Command { | ||
| & win-witr --help | Out-Null | ||
| } | ||
|
|
||
| Write-Host "Performance: Help command took $($result.TotalMilliseconds)ms" -ForegroundColor Cyan | ||
|
|
||
| # Verify it worked | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Help command failed" | ||
| exit 1 | ||
| } | ||
|
|
||
| exit 0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Performance test for process lookup - 100 iterations | ||
| # Measures time taken for each execution to look up a process by name | ||
|
|
||
| Write-Host "Testing process lookup performance over 100 iterations..." -ForegroundColor Yellow | ||
|
|
||
| # Verify win-witr works before starting measurements | ||
| & win-witr win-witr.exe | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "win-witr process lookup failed" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Run 100 iterations and measure each | ||
| Write-Host "Running 100 iterations of win-witr win-witr.exe..." -ForegroundColor Cyan | ||
| 1..100 | ForEach-Object { | ||
| Measure-Command { | ||
| & win-witr win-witr.exe | Out-Null | ||
| } | Select-Object TotalMilliseconds | ||
| } | ||
|
|
||
| Write-Host "Performance test completed successfully!" -ForegroundColor Green | ||
| exit 0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Performance test for PID lookup | ||
| # Measures time taken to look up a process by PID | ||
|
|
||
| Write-Host "Testing PID lookup performance..." -ForegroundColor Yellow | ||
|
|
||
| # Get current PowerShell PID | ||
| $currentPid = $PID | ||
|
|
||
| # Warm-up run | ||
| & win-witr $currentPid | Out-Null | ||
|
|
||
| # Measure performance - average of 5 runs | ||
| $measurements = @() | ||
| for ($i = 1; $i -le 5; $i++) { | ||
| $result = Measure-Command { | ||
| & win-witr $currentPid | Out-Null | ||
| } | ||
| $measurements += $result.TotalMilliseconds | ||
| } | ||
|
|
||
| $average = ($measurements | Measure-Object -Average).Average | ||
| $min = ($measurements | Measure-Object -Minimum).Minimum | ||
| $max = ($measurements | Measure-Object -Maximum).Maximum | ||
|
|
||
| Write-Host "Performance: PID lookup took avg=$([Math]::Round($average, 2))ms, min=$([Math]::Round($min, 2))ms, max=$([Math]::Round($max, 2))ms" -ForegroundColor Cyan | ||
|
|
||
| # Verify it worked | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "PID lookup failed" | ||
| exit 1 | ||
| } | ||
|
|
||
| exit 0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Performance test for process lookup | ||
| # Measures time taken to look up the win-witr process itself | ||
|
|
||
| Write-Host "Testing process lookup performance..." -ForegroundColor Yellow | ||
|
|
||
| # Warm-up run | ||
| & win-witr win-witr.exe | Out-Null | ||
|
|
||
| # Measure performance - average of 5 runs | ||
| $measurements = @() | ||
| for ($i = 1; $i -le 5; $i++) { | ||
| $result = Measure-Command { | ||
| & win-witr win-witr.exe | Out-Null | ||
| } | ||
| $measurements += $result.TotalMilliseconds | ||
| } | ||
|
|
||
| $average = ($measurements | Measure-Object -Average).Average | ||
| $min = ($measurements | Measure-Object -Minimum).Minimum | ||
| $max = ($measurements | Measure-Object -Maximum).Maximum | ||
|
|
||
| Write-Host "Performance: Process lookup took avg=$([Math]::Round($average, 2))ms, min=$([Math]::Round($min, 2))ms, max=$([Math]::Round($max, 2))ms" -ForegroundColor Cyan | ||
|
|
||
| # Verify it worked | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Process lookup failed" | ||
| exit 1 | ||
| } | ||
|
|
||
| exit 0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Performance test for version command | ||
| # Measures time taken to display version information | ||
|
|
||
| Write-Host "Testing version command performance..." -ForegroundColor Yellow | ||
|
|
||
| # Warm-up run | ||
| & win-witr --version | Out-Null | ||
|
|
||
| # Measure performance | ||
| $result = Measure-Command { | ||
| & win-witr --version | Out-Null | ||
| } | ||
|
|
||
| Write-Host "Performance: Version command took $($result.TotalMilliseconds)ms" -ForegroundColor Cyan | ||
|
|
||
| # Verify it worked | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Version command failed" | ||
| exit 1 | ||
| } | ||
|
|
||
| exit 0 |
This file was deleted.
Oops, something went wrong.
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
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.exewhich automatically finds the PID by process name.