Repository navigation
Add deterministic parser performance baseline suite with isolated CI workflow - #54
Draft
jkowalleck with Copilot wants to merge 2 commits into
Draft
jkowalleck with Copilot wants to merge 2 commits into
jkowalleck with Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Add deterministic performance benchmarking infrastructure for parser
Add deterministic parser performance baseline suite with isolated CI workflow
Jul 20, 2026
There was a problem hiding this comment.
Pull request overview
Adds a deterministic, fixture-backed performance baseline suite for the RFC3987 parser/validator APIs, and isolates it from the normal CI/release pipelines via a dedicated perf pytest marker and a separate scheduled workflow that publishes machine-readable artifacts.
Changes:
- Introduces
tests/test_perf.pyto benchmark parser and validator entry points with deterministic loop controls, build/init vs runtime split, and JSON output (includingtracemallocpeak memory). - Registers the
perfpytest marker and updates standard CI/test + publish workflows to exclude perf tests (-m "not perf"). - Adds a dedicated
.github/workflows/perf.ymlworkflow (manual + weekly schedule) to run perf tests and upload benchmark artifacts; updates contributor docs and ignores local perf output directory.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/test_perf.py |
Adds deterministic perf benchmark test producing structured JSON metrics for parser/validator APIs. |
pyproject.toml |
Registers the perf pytest marker. |
CONTRIBUTING.md |
Documents how to run perf benchmarks locally and clarifies default test invocation excludes perf. |
.gitignore |
Ignores .pytest_perf/ benchmark output directory. |
.github/workflows/python-tests.yml |
Excludes perf tests from the main CI test runs. |
.github/workflows/python-publish.yml |
Excludes perf tests from the publish pipeline’s test step. |
.github/workflows/perf.yml |
Adds an isolated, scheduled/manual perf workflow that uploads benchmark artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+104
to
+108
| def _measure_make_validator_build_init(term: str, valid_sample: str) -> float: | ||
| start = time.perf_counter() | ||
| validator = sut.make_syntax_validator(term) | ||
| assert validator(valid_sample) is True | ||
| return time.perf_counter() - start |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces a reproducible performance baseline for parser APIs using existing syntax fixtures, with machine-readable output for historical comparison. Perf coverage is isolated from regular test/release pipelines via a dedicated pytest marker and workflow split.
Perf benchmark module (
tests/test_perf.py)@pytest.mark.perftest that reusesvalid_syntax.json/invalid_syntax.json.parseis_valid_syntaxmake_syntax_validatorRFC3987_SYNTAX_TERM_VALIDATORS[term]is_valid_syntax_<term>validators (for fixture-backed terms)tracemallocpeak memory.RFC3987_PERF_OUTPUT_JSON, default.pytest_perf/perf-results.json).Deterministic loop controls
RFC3987_PERF_LOOPS(default1for CI safety)RFC3987_PERF_WARMUP_LOOPS(default1)Pytest marker registration
perfmarker inpyproject.tomlto avoid unknown-marker warnings and enable clean selector-based execution.CI pipeline separation
.github/workflows/perf.ymlworkflow_dispatch+schedule(weekly)artifacts/perf/...) for baseline retention/comparisonpython-tests.yml:pytest -m "not perf" ...python-publish.yml:pytest -m "not perf" ...Docs / contributor guidance
CONTRIBUTING.mdwith local perf execution, loop tuning, and JSON output path usage.