|
1 | 1 | name: Mock perf benchmark |
2 | 2 |
|
3 | | -# Temporary, manually-triggered benchmark to compare the mock hot path with and |
4 | | -# without the perf changes on Windows PowerShell 5.1 and PowerShell 7. |
5 | | -# Runs automatically on every push to the benchmark branch (workflow_dispatch |
6 | | -# does not work here because this file is not on the default branch). |
| 3 | +# Temporary, push-triggered benchmark to break down the mock hot-path perf changes |
| 4 | +# fix-by-fix on Windows PowerShell 5.1 and PowerShell 7. The branch HEAD already |
| 5 | +# contains all five fixes; we revert the two changed source files to the clean |
| 6 | +# pre-fix base (2f6ca66) and then re-apply individual fix hunks cumulatively, |
| 7 | +# rebuilding and re-measuring between each step. This isolates each fix's effect. |
| 8 | +# |
| 9 | +# Fixes (see _perf/patches): 1=Repair-EnumParameters early-out, 2=Test-ParameterFilter |
| 10 | +# PSVariable save/restore, 3=Set-ScriptBlockScope simple, 4=Resolve-Command simple, |
| 11 | +# 5=Test-ParameterFilter simple. workflow_dispatch only works on the default branch, |
| 12 | +# so trigger on push to this feature branch instead. |
7 | 13 |
|
8 | 14 | on: |
9 | 15 | workflow_dispatch: |
|
13 | 19 |
|
14 | 20 | jobs: |
15 | 21 | benchmark: |
16 | | - name: Mock perf (5.1 vs 7) |
| 22 | + name: Mock perf breakdown (5.1 vs 7) |
17 | 23 | runs-on: windows-latest |
18 | 24 | steps: |
19 | 25 | - name: Checkout |
20 | 26 | uses: actions/checkout@v4 |
21 | 27 | with: |
22 | 28 | fetch-depth: 10 # need history back to the clean base commit to revert the perf changes |
23 | 29 |
|
24 | | - - name: Build Pester (with perf changes) |
| 30 | + - name: Revert perf source to clean base (2f6ca66) |
25 | 31 | shell: pwsh |
26 | | - run: ./build.ps1 -Clean |
| 32 | + run: | |
| 33 | + git checkout 2f6ca66 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1 |
| 34 | + git --no-pager diff --stat 2f6ca66 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1 |
27 | 35 |
|
28 | | - - name: Benchmark WITH changes - PowerShell 7 |
| 36 | + - name: Build CLEAN |
29 | 37 | shell: pwsh |
30 | | - run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CHANGES' |
31 | | - |
32 | | - - name: Benchmark WITH changes - Windows PowerShell 5.1 |
| 38 | + run: ./build.ps1 -Clean |
| 39 | + - name: CLEAN - PS7 |
| 40 | + shell: pwsh |
| 41 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CLEAN' |
| 42 | + - name: CLEAN - 5.1 |
33 | 43 | shell: powershell |
34 | | - run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CHANGES' |
| 44 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CLEAN' |
35 | 45 |
|
36 | | - - name: Revert the perf changes (clean source at the pre-fix base commit) |
| 46 | + - name: Apply Fix1 |
37 | 47 | shell: pwsh |
38 | | - run: | |
39 | | - git checkout 2f6ca66 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1 |
40 | | - git --no-pager diff --stat 2f6ca66 -- src/functions/Mock.ps1 src/functions/Pester.Scoping.ps1 |
| 48 | + run: git apply --ignore-whitespace _perf/patches/fix1_repair.patch |
| 49 | + - name: Build +FIX1 |
| 50 | + shell: pwsh |
| 51 | + run: ./build.ps1 |
| 52 | + - name: '+FIX1 - PS7' |
| 53 | + shell: pwsh |
| 54 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label '+FIX1' |
| 55 | + - name: '+FIX1 - 5.1' |
| 56 | + shell: powershell |
| 57 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label '+FIX1' |
41 | 58 |
|
42 | | - - name: Rebuild Pester (clean source, PowerShell-only change) |
| 59 | + - name: Apply Fix2 |
| 60 | + shell: pwsh |
| 61 | + run: git apply --ignore-whitespace _perf/patches/fix2_psvar.patch |
| 62 | + - name: Build +FIX1-2 |
43 | 63 | shell: pwsh |
44 | 64 | run: ./build.ps1 |
| 65 | + - name: '+FIX1-2 - PS7' |
| 66 | + shell: pwsh |
| 67 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label '+FIX1-2' |
| 68 | + - name: '+FIX1-2 - 5.1' |
| 69 | + shell: powershell |
| 70 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label '+FIX1-2' |
45 | 71 |
|
46 | | - - name: Benchmark CLEAN baseline - PowerShell 7 |
| 72 | + - name: Apply Fix3 |
47 | 73 | shell: pwsh |
48 | | - run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CLEAN' |
| 74 | + run: git apply --ignore-whitespace _perf/patches/fix3_scoping.patch |
| 75 | + - name: Build +FIX1-3 |
| 76 | + shell: pwsh |
| 77 | + run: ./build.ps1 |
| 78 | + - name: '+FIX1-3 - PS7' |
| 79 | + shell: pwsh |
| 80 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label '+FIX1-3' |
| 81 | + - name: '+FIX1-3 - 5.1' |
| 82 | + shell: powershell |
| 83 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label '+FIX1-3' |
49 | 84 |
|
50 | | - - name: Benchmark CLEAN baseline - Windows PowerShell 5.1 |
| 85 | + - name: Apply Fix4 + Fix5 (all five) |
| 86 | + shell: pwsh |
| 87 | + run: | |
| 88 | + git apply --ignore-whitespace _perf/patches/fix4_resolve.patch |
| 89 | + git apply --ignore-whitespace _perf/patches/fix5_testfilter.patch |
| 90 | + - name: Build ALL5 |
| 91 | + shell: pwsh |
| 92 | + run: ./build.ps1 |
| 93 | + - name: ALL5 - PS7 |
| 94 | + shell: pwsh |
| 95 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'ALL5' |
| 96 | + - name: ALL5 - 5.1 |
51 | 97 | shell: powershell |
52 | | - run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'CLEAN' |
| 98 | + run: ./_perf/Measure-MockPerf.ps1 -Runs 9 -Label 'ALL5' |
0 commit comments