Skip to content

Latest commit

 

History

History
98 lines (67 loc) · 3.64 KB

File metadata and controls

98 lines (67 loc) · 3.64 KB

Benchmarking

YiiPress uses PHPBench to track performance regressions.

Generating benchmark data

Generate 10,000 small test entries (default):

make bench-generate

Generate 1,000 realistic entries (~27KB each, with links, images, tables, styled text):

make bench-generate-realistic

Custom entry count:

make bench-generate 5000

Generated data is stored in benchmarks/data/ and is gitignored.

Running benchmarks

Run all benchmarks:

make bench

Run a specific benchmark class:

BENCH_FILTER=LargeContentBuildBench make bench

Profile the public build command with Xdebug:

make profile-build CLI_ARGS='build --content-dir=benchmarks/data/content --output-dir=runtime/profile-output --workers=1 --no-cache'

Print build phase timings without Xdebug:

make yii CLI_ARGS='build --content-dir=benchmarks/data/content --output-dir=runtime/profile-output --workers=4 --no-cache --profile'

Render the full build path without writing site output files:

make yii CLI_ARGS='build --content-dir=benchmarks/data/content --output-dir=runtime/profile-output --workers=4 --no-cache --no-write --profile'

Use --profile for quick before/after checks while optimizing. Use make profile-build when call-level attribution is needed. Use --no-write to separate render/template/processor cost from output directory and file writing cost.

Benchmark classes

  • ContentParserBench — measures parsing speed for site config, navigation, collections, authors, and entries (with and without body loading)
  • MarkdownRendererBench — measures MD4C markdown-to-HTML rendering for short and long documents
  • SyntaxHighlighterBench — measures the reusable highlighter package path for plain HTML, raw code, a single highlighted block, and a page with many highlighted blocks
  • AssetFingerprintingBench — measures fingerprint lookup and HTML asset URL rewriting
  • BuildProfileBench — measures overhead of disabled and enabled build phase timers
  • OEmbedProcessorBench — measures standalone URL-to-embed expansion across pluggable oEmbed providers
  • SmallSiteBuildBench — measures the public yii build command end to end on 10k small entries, including full rebuilds, no-write renders, and incremental rebuilds
  • LargeContentBuildBench — measures the public yii build command end to end on 1k realistic entries (~27KB each), including full rebuilds, no-write renders, and incremental rebuilds

Baseline results

10k small entries (~1KB each)

Benchmark Time
Full rebuild, sequential ~3.438s
Full rebuild, 4 workers ~2.830s
Incremental rebuild, no changes ~357.636ms
Incremental rebuild, 1 changed entry ~357.465ms

1k realistic entries (~27KB each)

Benchmark Time
Full rebuild, sequential ~2.016s
Full rebuild, 4 workers ~1.068s
Incremental rebuild, no changes ~107.945ms
Incremental rebuild, 1 changed entry ~108.596ms

These end-to-end benchmarks intentionally go through the public CLI entry point instead of internal renderer/parser classes, so they track real rebuild timing rather than component-only throughput.

Measured on PHP 8.5 with ext-md4c, ext-yaml, and ext-pcntl, xdebug off, OPCache disabled.

Benchmarks are run with xdebug disabled automatically (make bench sets XDEBUG_MODE=off).