Skip to content

Add CodSpeed performance benchmarks#2

Open
codspeed-hq[bot] wants to merge 1 commit into
mainfrom
codspeed-wizard-1780399327895
Open

Add CodSpeed performance benchmarks#2
codspeed-hq[bot] wants to merge 1 commit into
mainfrom
codspeed-wizard-1780399327895

Conversation

@codspeed-hq
Copy link
Copy Markdown

@codspeed-hq codspeed-hq Bot commented Jun 2, 2026

What this does

This PR integrates CodSpeed for continuous performance tracking. It adds benchmarks for performance-critical utility functions and a GitHub Actions workflow that runs them on every push to main and on pull requests.

Changes

Benchmark harness

  • Installed @codspeed/vitest-plugin in the src workspace
  • Created src/vitest.bench.config.mts with the CodSpeed vitest plugin configured in simulation mode
  • Added 18 benchmarks across 3 files covering core utility functions:
    • Text normalization (src/benchmarks/text-normalization.bench.ts): normalizeString and unescapeHtmlEntities with varying input sizes and option combinations
    • Tool ID sanitization (src/benchmarks/tool-id.bench.ts): sanitizeToolUseId, truncateOpenAiCallId, and sanitizeOpenAiCallId covering clean IDs, special characters, and long inputs requiring hash truncation
    • Command parsing (src/benchmarks/parse-command.bench.ts): parseCommand with simple commands, chained operators, pipes/redirections/subshells, multi-line scripts, and shell variable expansions

CI workflow

  • Added .github/workflows/codspeed.yml that runs on push to main, pull requests, and manual dispatch
  • Uses the existing setup-node-pnpm composite action for consistent dependency installation
  • Runs benchmarks in CodSpeed simulation mode (deterministic CPU simulation, less than 1% variance)
  • Uses OIDC authentication (no secrets required)

README

  • Added CodSpeed badge alongside existing project badges

How to run benchmarks locally

cd src && npx vitest bench --config vitest.bench.config.mts --run

Next steps

  • Review the initial benchmark results on the CodSpeed dashboard
  • Add benchmarks for additional hot paths as needed (e.g., message consolidation in @roo-code/core, JSON schema validation)
  • Consider enabling performance checks to flag regressions on pull requests

@codspeed-hq
Copy link
Copy Markdown
Author

codspeed-hq Bot commented Jun 2, 2026

Congrats! CodSpeed is installed 🎉

🆕 18 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


Open in CodSpeed

@codspeed-hq codspeed-hq Bot marked this pull request as ready for review June 2, 2026 11:33
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.

0 participants