Add CodSpeed performance benchmarks for the MPD parser - #1
Open
codspeed-hq[bot] wants to merge 1 commit into
Open
Add CodSpeed performance benchmarks for the MPD parser#1codspeed-hq[bot] wants to merge 1 commit into
codspeed-hq[bot] wants to merge 1 commit into
Conversation
Set up a vitest + @codspeed/vitest-plugin benchmark suite that measures DashParser.parse, the MPD manifest parser that runs on every manifest load and refresh. Benchmarks are isolated in a dedicated benchmarks/ package so they run on a modern Node.js toolchain, and a GitHub Actions workflow runs them on CodSpeed in simulation mode.
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.
Summary
This PR sets up continuous performance measurement with CodSpeed for dash.js.
It adds a benchmark suite targeting
Dash.dependencies.DashParser— the component that turns a raw MPEG-DASH manifest (an XML string) into the JavaScript object tree the player consumes. Parsing runs on every manifest load and every live-manifest refresh, so it is a hot, CPU-bound path and a meaningful target for regression tracking.What was added
benchmarks/— an isolated benchmark package with its ownpackage.json. It is deliberately kept separate from the root project so the benchmarks can run on a modern Node.js toolchain (vitest) without pulling in the legacy, browser-only build tooling (grunt/jasmine/phantomjs) that no longer installs cleanly on current Node versions.dashParser.bench.js— four benchmarks covering SegmentTemplate-based and SegmentList-based manifests at small and large sizes.loadDash.js— loads the real, unmodified parser source (DashParser,X2JS,ObjectIron,Q) into a Node.jsvmcontext and provides a browser-like environment (window.DOMParservia@xmldom/xmldom), so the benchmarks exercise the actual production code.fixtures.js— generates representative manifests of varying sizes.vitest.config.js— wires in@codspeed/vitest-plugin.README.md— documents the setup and how to run it..github/workflows/codspeed.yml— runs the benchmarks on CodSpeed in simulation mode on pushes tomaster, on pull requests, and via manual dispatch. It uses OIDC authentication (id-token: write) and the latestCodSpeedHQ/action@v4.Local verification
The suite was verified locally with the CodSpeed CLI in simulation mode. All four benchmarks are measured and results upload successfully:
Running locally
cd benchmarks npm install npm run benchNext steps