Skip to content

Add scaling and serve-loop benchmarks to the CodSpeed suite - #89

Merged
shenxianpeng merged 2 commits into
mainfrom
claude/mkdocs-issue-4167-15dhse
Aug 12, 2026
Merged

shenxianpeng merged 2 commits into
mainfrom
claude/mkdocs-issue-4167-15dhse

Conversation

@shenxianpeng

Copy link
Copy Markdown
Member

Follow-up to #88, adding the scenarios from (closed) #87 that the wizard-generated suite doesn't cover — the ones needed to track the build-performance work for upstream mkdocs/mkdocs#3695:

  • test_full_build_scaling[10|50|200] — full builds of the deterministic corpus at several sizes. Sizes are overridable via MKDOCS_BENCH_SIZES for local scaling studies; a local run at 100/400/1600 pages measured 7.8 / 9.3 / 22.1 ms per page — 4× the pages costs ~9.5× the time, the superlinear growth reported in Improve performance and authoring experience of mkdocs serve mkdocs/mkdocs#3695.
  • test_dirty_rebuild — a rebuild with no modified files, approximating the mkdocs serve --dirty inner loop (still re-walks docs, rebuilds nav, recreates the Jinja env and re-runs all plugin events). Local wall time: ~66 ms for a 50-page site.
  • test_template_render_large_nav — a single page rendered against the largest site's navigation, isolating the O(N²) sitewide template-rendering term (built-in themes iterate the full nav for every page).

corpus.write_site() gains optional sections / pages_per_section parameters; defaults are unchanged, so the existing 23 benchmarks and their CodSpeed history are unaffected. The full suite is now 28 benchmarks; ruff/isort clean; pytest benchmarks passes in ~9 s un-instrumented.

Related Issue

Groundwork for upstream mkdocs/mkdocs#3695; completes the consolidation of #87 into the #88 structure.

Checklist

  • New tests added for new behavior (if applicable) — the new benchmarks
  • Documentation updated (if applicable) — module docstring documents MKDOCS_BENCH_SIZES
  • Release notes docs/about/release-notes.md updated (if applicable)

🤖 Generated with Claude Code

https://claude.ai/code/session_018Hw7x9BxxpuKiLkzjLczp9


Generated by Claude Code

Extend the benchmark suite merged in #88 with the scenarios needed to
track the build-performance work for upstream issue mkdocs/mkdocs#3695:

* full builds of the deterministic corpus at several sizes (10/50/200
  pages by default, overridable via MKDOCS_BENCH_SIZES for local
  scaling studies) - a local run at 100/400/1600 pages measured
  7.8/9.3/22.1 ms per page, i.e. clearly superlinear growth
* a dirty rebuild with no modified files, approximating the
  'mkdocs serve --dirty' inner loop
* a single page rendered against the largest site's navigation,
  isolating the O(N^2) sitewide template-rendering term

corpus.write_site() gains optional sections/pages_per_section
parameters (defaults unchanged, existing benchmarks unaffected).
@shenxianpeng shenxianpeng added the enhancement New feature or request label Aug 12, 2026
@shenxianpeng shenxianpeng added this to the v1.8.0 milestone Aug 12, 2026
@codspeed

codspeed Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 14.6%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 22 untouched benchmarks
🆕 5 new benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_search_index_generate 14.8 ms 17.3 ms -14.6%
🆕 test_dirty_rebuild N/A 869.4 ms N/A
🆕 test_full_build_scaling[10] N/A 1.9 s N/A
🆕 test_full_build_scaling[200] N/A 29.1 s N/A
🆕 test_full_build_scaling[50] N/A 6.8 s N/A
🆕 test_template_render_large_nav N/A 58.8 ms N/A

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/mkdocs-issue-4167-15dhse (b5f10dc) with main (bb9d39d)

Open in CodSpeed

Copy link
Copy Markdown
Member Author

The reported regression on test_search_index_generate (14.8ms → 17.3ms) is not caused by this PR: the diff only touches benchmarks/corpus.py (adding optional sections/pages_per_section kwargs to write_site() with unchanged defaults) and adds the new benchmarks/test_scaling.py file. test_search_index_generate lives in test_search.py (merged in #88, untouched here), and its inputs — the rendered_pages fixture and the default (no-kwargs) write_site() call in conftest.py — are unaffected by this change.

CodSpeed's own report flags "Different runtime environments detected" on this comparison, which matches: this looks like CI-runner measurement noise rather than a real regression. No core code (mkdocs/contrib/search/ or otherwise) was modified.

@shenxianpeng since acknowledging on CodSpeed requires dashboard access, could you acknowledge this one (or re-run to confirm it clears)? Happy to investigate further if it persists on a re-run.


Generated by Claude Code

@shenxianpeng
shenxianpeng merged commit e1f0031 into main Aug 12, 2026
22 of 23 checks passed
@shenxianpeng
shenxianpeng deleted the claude/mkdocs-issue-4167-15dhse branch August 12, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant