feat: redesign benchmark system with CI integration#7197
Open
teredasites wants to merge 1 commit intomaplibre:mainfrom
Open
feat: redesign benchmark system with CI integration#7197teredasites wants to merge 1 commit intomaplibre:mainfrom
teredasites wants to merge 1 commit intomaplibre:mainfrom
Conversation
…ild support Add a two-tier benchmark architecture: 1. Microbenchmarks (vitest bench) - pure computation benchmarks that run in CI on every PR without browser/WebGL dependencies. Covers hot paths like polygon subdivision, covering tile computation, filter creation, and style validation. 2. CI-oriented E2E runner (run-benchmarks-ci.ts) - headless Chrome runner that produces structured JSON output with pass/fail semantics based on configurable regression thresholds. Key changes: - Add vitest.config.bench.ts for microbenchmark configuration - Add computation.bench.ts with subdivide, covering tiles, filter, and style validation benchmarks - Add run-benchmarks-ci.ts for headless CI execution with JSON output and baseline comparison support - Add format-bench-results.ts for markdown output suitable for PR comments - Add benchmark.yml GitHub Actions workflow running both tiers on PRs - Add index-prod.html to run benchmarks against dist/ production builds and compare with previous versions from CDN (unpkg) - Update package.json with benchmark-ci and benchmark-micro scripts - Update README with comprehensive documentation of the new architecture - Keep existing browser-based visual benchmark system fully intact Closes maplibre#982
Collaborator
|
Was this generated by AI? because it falls to address this issue in so many aspects... |
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.
/claim #982
Summary
Redesigns the benchmark system to address the issues raised in #982:
Problem
The existing benchmarks require a custom rollup build that tightly couples to internal module structure, making them fragile across version changes. They don't run in CI, produce results that are hard to interpret programmatically, and comparing previous versions requires pre-built artifacts stored on GitHub Pages.
Solution: Two-Tier Architecture
Tier 1: Microbenchmarks (CI, fast)
Pure-computation benchmarks that run via
vitest benchon every PR. These test isolated hot paths without needing a browser, WebGL, or network:Run locally with
npm run benchmark-micro.Tier 2: E2E Benchmarks (CI + manual)
A new CI-oriented headless Chrome runner (
run-benchmarks-ci.ts) that:format-bench-results.ts) for PR comment postingRun locally with
npm run benchmark-ci.Production Build Support
A new
index-prod.htmlpage runs benchmarks against the standarddist/maplibre-gl.jsproduction build rather than the custom-bundledbenchmarks_generated.js. Previous versions are loaded from unpkg CDN, so no per-version build artifacts need to be generated or stored.What's Preserved
The existing browser-based visual benchmark suite is fully preserved -- the original
index.html, rollup config,benchmarks_view.tsx, and all Benchmark subclasses are untouched. The new system coexists alongside it (acceptance criteria #3).Changes
vitest.config.bench.tstest/bench/benchmarks/computation.bench.tstest/bench/run-benchmarks-ci.tstest/bench/format-bench-results.tstest/bench/versions/index-prod.html.github/workflows/benchmark.ymlpackage.jsonbenchmark-ciandbenchmark-microscriptstest/bench/README.mdtsconfig.json.gitignoreAcceptance Criteria
benchmark.ymlworkflow runs microbenchmarks and E2E benchmarks on every PR and push to main.index-prod.htmlloads any published version from unpkg CDN. No need to generate per-version artifacts.Test plan
npm run benchmark-microruns microbenchmarks successfully via vitest benchnpm run start-bench+npm run benchmark-ciproduces JSON outputnpm run benchmark-ci -- --baseline results.json --threshold 10detects regressionsindex-prod.htmlloads correctly and can compare against CDN versionsnpm run benchmarkcontinues to work unchanged