Skip to content

perf(xslt): add phase and reuse measurements - #260

Merged
polaz merged 2 commits into
mainfrom
perf/#259-xslt-phase-gates
Oct 21, 2026
Merged

polaz merged 2 commits into
mainfrom
perf/#259-xslt-phase-gates

Conversation

@polaz

@polaz polaz commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add opt-in XSLT phase measurements over the production compiler, runtime and serializer, preserving operation budgets.
  • Compare compilation, result construction, serialization, retained execution and end-to-end work against pinned libxslt with exact-output checks, separate allocation profiling and reproducible artifacts.
  • Gate concurrent immutable stylesheet reuse, dependency replacement and cumulative work; document cache ownership and measurement boundaries.

Testing

Repeated comparative measurements; phase/reuse contracts; workspace default, all-feature and XML-backend suites; lint, docs, alloc-only, WASM, ASAN mutation and workflow checks.

Closes #259

Summary by CodeRabbit

  • New Features

    • Added opt-in XSLT measurement capabilities for result-tree construction, serialization, execution usage, and output sizing.
    • Added reproducible XSLT benchmarks covering latency, memory allocation, throughput phases, workload sizes, and output amplification.
    • Added benchmark evidence generation with JSON metrics, percentile summaries, resource measurements, and correctness validation.
  • Documentation

    • Added an XSLT performance runbook covering benchmark setup, measurement methodology, profiling, reuse behavior, and limitations.
    • Linked the performance guidance from existing benchmark documentation.
  • Tests

    • Added coverage for execution phases, concurrent stylesheet reuse, resource authorization, output consistency, and benchmark validation.

Measure compiler, result construction, serializer and retained execution over the production kernels with one carried resource meter. Compare exact outputs with pinned libxslt and keep latency, allocation and process RSS evidence separate.

Qualify concurrent immutable reuse, dependency replacement and cumulative limits. Publish reproducible measurement artifacts through the required XSLT gate without introducing a global compilation cache.

Closes #259
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T16:07:17.838736Z 68cde99 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: structured-world/xml-sec/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e94df2d7-a9f4-4ad5-a5e2-ed82cf2c73a1
📥 Commits

Reviewing files that changed from the base of the PR and between 625950c and 68cde99.

📒 Files selected for processing: 4
  • .github/workflows/ci.yml
  • benchmarks/cmake/libxml2/LibXml2Config.cmake
  • scripts/benchmark-xslt.mjs
  • scripts/benchmark-xslt.test.mjs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: structured-world/xml-sec/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 54b3f723-4f78-4fd2-bec4-be3b7bdafc5f
📥 Commits

Reviewing files that changed from the base of the PR and between 6157120 and 625950c.

📒 Files selected for processing: 14
  • .github/workflows/ci.yml
  • benches/support/xslt.rs
  • benchmarks/xslt-alloc.rs
  • benchmarks/xslt-latency.rs
  • benchmarks/xslt-oracle.c
  • crates/xml-sec-xslt/Cargo.toml
  • crates/xml-sec-xslt/README.md
  • crates/xml-sec-xslt/tests/phase_contract.rs
  • docs/benchmarks.md
  • docs/xslt-performance.md
  • scripts/benchmark-xslt.mjs
  • scripts/benchmark-xslt.test.mjs
  • src/xslt/lib.rs
  • src/xslt/runtime.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The change separates XSLT result-tree construction from serialization and adds phase-level Rust and libxslt benchmarks. It also adds contract tests for execution budgets, concurrent stylesheet reuse, and resolver identity, plus a reproducible measurement harness and CI artifact collection.

Changes: XSLT Measurement and Reuse

Layer / File(s) Summary
Execution phases and reuse contracts
src/xslt/runtime.rs, src/xslt/lib.rs, crates/xml-sec-xslt/tests/phase_contract.rs
Execution setup returns admitted usage with the execution state. Tree construction and serialization are split, with a benchmark-only measured-tree API. Tests cover output equivalence, budget accounting, concurrent reuse, and resolver identity changes.
Rust fixtures and phase benchmarks
benches/support/xslt.rs, benchmarks/xslt-alloc.rs, benchmarks/xslt-latency.rs, crates/xml-sec-xslt/Cargo.toml
Fixtures generate two workload shapes at two sizes. Rust benchmarks measure compilation, tree construction, serialization, retained execution, and end-to-end work, with output checks and explicit resource limits.
libxslt oracle and evidence harness
benchmarks/xslt-oracle.c, scripts/benchmark-xslt.mjs, scripts/benchmark-xslt.test.mjs
The oracle and Node.js harness run matching phases and validate outputs and measurement metadata. The harness records timing, RSS, allocation, provenance, and optional Valgrind evidence. Tests cover summary calculations, RSS parsing, validation, and output-path containment.
CI execution and benchmark runbook
.github/workflows/ci.yml, docs/xslt-performance.md, docs/benchmarks.md, crates/xml-sec-xslt/README.md
CI runs phase and reuse checks, performs heap-instrumented measurements, and uploads benchmark artifacts. The runbook documents commands, phase boundaries, evidence fields, reuse behavior, and measurement guidance.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant BenchmarkScript
  participant RustBenchmarks
  participant LibxsltOracle
  participant EvidenceDirectory
  BenchmarkScript->>RustBenchmarks: run phase measurements on generated fixtures
  RustBenchmarks-->>BenchmarkScript: return JSON timing and size measurements
  BenchmarkScript->>LibxsltOracle: run matching phase measurements
  LibxsltOracle-->>BenchmarkScript: return JSON timing and size measurements
  BenchmarkScript->>EvidenceDirectory: write validated run and aggregate evidence
Loading
Merge Risk: ⚪ Minimal · up to 62595

This change splits XSLT result-tree construction from serialization behind a benchmark-only feature. It also adds opt-in phase measurements, contract tests, and CI artifact collection. No concrete merge-blocking risk was identified; normal CI results should be the final check.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 30.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 9 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: adding XSLT phase and immutable stylesheet reuse measurements.
Linked Issues check Passed Issue #259 is directly linked and has coding requirements. The PR adds opt-in production phase hooks in src/xslt/runtime.rs, gated by benchmark-internals, and separates tree construction from seri…
Out of Scope Changes check Passed The changed files support issue #259. Runtime changes expose the measurements. Benchmark fixtures, the libxslt oracle, the harness, allocation profiling, documentation, contract tests, and CI artifact…
Full details: Linked Issues check

Explanation

Issue #259 is directly linked and has coding requirements. The PR adds opt-in production phase hooks in src/xslt/runtime.rs, gated by benchmark-internals, and separates tree construction from serialization. scripts/benchmark-xslt.mjs runs compile, tree, serialize, retained, and end-to-end phases for two workload shapes and two sizes against pinned libxslt. It validates exact output bytes, records raw samples and p50/p95/p99 values, records RSS and amplification, fingerprints sources and dependencies, and retains evidence. The runbook documents phase boundaries, allocation exclusions, cache ownership, dependency identity, reuse, and budget isolation. phase_contract.rs covers output equivalence, serialization limits, concurrent reuse, and dependency replacement. The CI change and benchmark tests provide the requested repeatable gates and validation coverage.

Full details: Out of Scope Changes check

Explanation

The changed files support issue #259. Runtime changes expose the measurements. Benchmark fixtures, the libxslt oracle, the harness, allocation profiling, documentation, contract tests, and CI artifacts implement or validate the requested measurement, reuse, resource, and reproducibility requirements. No unrelated change is demonstrated.

Full details: Docstring Coverage

Explanation

Docstring coverage is 30.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 9 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@polaz
polaz merged commit a5f5f10 into main Oct 21, 2026
107 of 109 checks passed
@polaz
polaz deleted the perf/#259-xslt-phase-gates branch October 21, 2026 17:14
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.

perf(xslt): qualify phase and reuse measurements

1 participant