Skip to content

ci: compare the performance measurements with recorded baselines - #155

Merged
fadwen merged 7 commits into
mainfrom
ci/performance-gate
Nov 26, 2026
Merged

fadwen merged 7 commits into
mainfrom
ci/performance-gate

Conversation

@fadwen

@fadwen fadwen commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #136. CIC-13 asks for a gate that compares execution time and memory with recorded baselines for the code that has performance tests. The performance tests of #151 measured the log readers and held absolute limits; nothing compared a run with the runs before it. Stacked on #154, which makes main's CI pass again; merge that first.

Changes

  • Tests/Performance/AgentLogReader.Tests.ps1: each measurement is also written as a JSON line (name, lines, seconds, megabytes kept, PowerShell version) to the file ISL_PERFORMANCE_RESULTS names.
  • Build/Test-PerformanceBaseline.ps1: reads those lines, takes the median of each measurement over the runs, and compares it with the baseline of the runner: ImageOS/architecture/PowerShell major.minor on a hosted runner (win25-vs2026/X64/7.6 today), the computer's name elsewhere. A median above baseline * (1 + margin) fails; a measurement with a baseline that was not taken fails; a runner with no baseline, such as a new image or a developer's computer, gets a warning with the medians and passes, so that an image change does not fail every build. -Record prints the medians as a baseline entry. Numbers are written in the invariant culture, so an entry recorded under de-DE still reads 1.06, and a file with measurements from more than one PowerShell version is refused.
  • Tests/Performance/Baselines.psd1: the baselines of win25-vs2026/X64/7.6 for both readers at 10,000 lines, and the margins: 1.0 for time and 0.25 for memory.
  • .github/workflows/quality-gates.yml: the performance step runs the suite three times with the variable set, each run writing its NUnit file to reports/performance/run<n> and adding to the job summary, and then the gate; measurements.jsonl is uploaded with the other reports.
  • Tests/Unit/Build/Test-PerformanceBaseline.Tests.ps1 (12 tests): within and over the margin for each measure, the median against one slow run, a baseline with nothing measured, no measurements, a size without a baseline, two PowerShell versions in one file, the default runner key, a runner without baselines, and -Record, also under de-DE.
  • docs/StandardsDecisions.md, CLAUDE.md and CHANGELOG.md.

Verification

  • The margins come from three dispatched runs of this branch (45726300466, 45726303917, 45726307359), nine runs of the suite on win25-vs2026. The job medians were 0.90, 1.06 and 1.10 s for Get-IntuneAgentLog and 1.24, 1.63 and 1.69 s for Get-IntuneAgentTimeline at 10,000 lines; the first run of each job took about twice as long as the other two, which the median leaves out. Memory kept was 25.7 and 20.2 MB in every run. The baselines are the middle job's medians.
  • The gate run on those jobs' figures with the recorded baselines: within the limits (2.12 s and 3.26 s; 32.12 and 25.25 MB).
  • Test-PerformanceBaseline.Tests.ps1: 12 passed on PowerShell 7.6 and Windows PowerShell 5.1. PSScriptAnalyzer clean in 354 files; Markdown links clean.
  • The CI of this head runs the gate against the baselines for the first time.

Notes

  • The Windows PowerShell 5.1 and ARM jobs do not run the performance suite, so they have no baselines; adding them is a matter of recording one with -Record from those jobs.
  • A new runner image passes ungated with a warning until its baselines are recorded; the warning prints the entry.

CIC-13. The performance tests write each measurement to the file ISL_PERFORMANCE_RESULTS names, the tests job runs them three times, and Build/Test-PerformanceBaseline.ps1 compares the median of each with the baseline recorded for the runner image in Tests/Performance/Baselines.psd1. A runner without a baseline is reported and not gated.
… runs

Three jobs, three runs of the suite each: the medians of the jobs were up to a third apart in time and equal in memory, so a median twice its baseline, or a quarter more memory, fails the build.

Closes #136

@fadwen-ai fadwen-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Four nits on the performance gate (CIC-13). The design holds up: the median of three runs, a baseline keyed by runner image, architecture and PowerShell version, failing when a baseline has no measurement, and a warning (not a failure) for a new image. The margins match the recorded runs, and the 8 unit tests cover the main paths.

  1. Build/Test-PerformanceBaseline.ps1:142: -Record formats decimals in the current culture. Under de-DE it prints Seconds = 1,06, which a psd1 reads as an array.
  2. .github/workflows/quality-gates.yml:130: the performance step no longer writes an NUnit report or a job summary. A separate output folder for each run would keep both.
  3. Tests/Performance/AgentLogReader.Tests.ps1:162: the results file is only appended to, so a local -Record takes its median over earlier runs as well.
  4. Tests/Unit/Build/Test-PerformanceBaseline.Tests.ps1:149: no test covers a measurement without a baseline, which every CI run hits at 2,500 lines, or the default -Runner key.

Details are in the inline comments.

🤖 Generated with Claude Code

Comment thread Build/Test-PerformanceBaseline.ps1 Resolved
Comment thread .github/workflows/quality-gates.yml Resolved
…un's reports

-f wrote 1,06 under de-DE, which a baseline entry pasted into the data file reads as an array. Each performance run writes its NUnit file to a folder of its own and adds to the job summary. A results file with measurements from more than one PowerShell version is refused, and the tests cover a size without a baseline and the default runner key.
@fadwen

fadwen commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Round 1: 4 fixed, 0 not changed.

  • Build/Test-PerformanceBaseline.ps1:142 (culture): numbers are formatted in the invariant culture; a test records under de-DE.
  • .github/workflows/quality-gates.yml:130 (reports): each run writes its NUnit file to its own folder and adds to the job summary.
  • Tests/Performance/AgentLogReader.Tests.ps1:162 (appended file): measurements from more than one PowerShell version are refused, and the help says to delete the file before recording.
  • Tests/Unit/Build/Test-PerformanceBaseline.Tests.ps1:149 (coverage): tests for a size without a baseline and for the default runner key.

The branch also carries #154's round-1 fix, merged up. 12 passed on PowerShell 7.6 and 5.1; PSScriptAnalyzer clean in 354 files; CI is dispatched on this head. The description is updated.

🤖 Generated with Claude Code

@fadwen-ai fadwen-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Round 2: all four round-1 findings are fixed, and I resolved their threads.

  • Culture: Format-Invariant writes the numbers in the -Record entry, the warning and the comparison lines, and the de-DE test fails against the round-1 script.
  • Reports: each run writes reports/performance/run<n>/testResults.xml (Invoke-Tests.ps1 creates the folder) and appends to the job summary.
  • Appended file: measurements from more than one PowerShell version are refused, and the help says to delete the file before a recording. Two recordings on the same version are not told apart. I accept the reason given: their median still describes that version.
  • Coverage: new tests for a size without a baseline, the default runner key, and two versions in one file.

I re-read the whole diff against fix/ci-runner-tests and found nothing new. Test-PerformanceBaseline.Tests.ps1 passes 12 of 12 on PowerShell 7.6.10 and Windows PowerShell 5.1. With the round-1 script, the two new tests (two versions in one file, and the de-DE record) fail on both versions, so they test the fixes. The dispatched Quality Gates run on d3dc7a4 (45728469676) was still in progress when I approved; it is the first run of the gate against the recorded baselines.

🤖 Generated with Claude Code

Base automatically changed from fix/ci-runner-tests to main November 26, 2026 00:31
@fadwen
fadwen merged commit f5ccddd into main Nov 26, 2026
@fadwen
fadwen deleted the ci/performance-gate branch November 26, 2026 00:32
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.

CI has no performance gate (CIC-13)

2 participants