-
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 3 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,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 |
2 changes: 1 addition & 1 deletion
2
tests/performance/stess_nested_shells.bat → tests/performance/stress_nested_shells.bat
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
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.
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
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 97b4fd2 - removed the .bat wrapper since CI now runs .ps1 files directly.