Skip to content

Add CodSpeed performance benchmarks#1867

Merged
riderx merged 1 commit intomainfrom
codspeed-wizard-1774582968264
Mar 27, 2026
Merged

Add CodSpeed performance benchmarks#1867
riderx merged 1 commit intomainfrom
codspeed-wizard-1774582968264

Conversation

@codspeed-hq
Copy link
Copy Markdown
Contributor

@codspeed-hq codspeed-hq bot commented Mar 27, 2026

Summary

This PR sets up continuous performance tracking with CodSpeed for the capgo backend. It adds a benchmark suite targeting core utility functions that are called on hot paths (device updates, password validation, analytics queries) and a GitHub Actions workflow to run them automatically.

What changed

  • Benchmark files (benches/): Three benchmark files covering password policy validation, device comparison/normalization, and analytics limit normalization -- all pure functions with no external service dependencies.
  • Vitest benchmark config (vitest.config.bench.ts): Dedicated Vitest configuration with the @codspeed/vitest-plugin for instrumented measurements.
  • GitHub Actions workflow (.github/workflows/codspeed.yml): Runs benchmarks on pushes to main, on pull requests, and on manual dispatch (for CodSpeed backtesting). Uses OIDC authentication and simulation mode.
  • @codspeed/vitest-plugin added as a dev dependency with lockfile updated.
  • CodSpeed badge added to README alongside existing project badges.

Benchmarked functions

File Functions Why
password_policy.ts getPasswordUtf8ByteLength, getEffectivePasswordMinLength, getPasswordPolicyValidationErrors Called on every signup/password change; regex + UTF-8 encoding
deviceComparison.ts toComparableDevice, toComparableExisting, hasComparableDeviceChanged, buildNormalizedDeviceForWrite Called on every device update; object normalization and field-by-field diff
cloudflare.ts normalizeAnalyticsLimit Called on every analytics query; numeric validation and boundary clamping

Next steps

  • After merging, CodSpeed will run a backtest to establish baseline measurements on the main branch.
  • Future PRs will automatically get performance change reports in PR comments.
  • Additional benchmarks can be added to benches/ following the same pattern.

Test plan

  • Benchmarks pass locally with npx vitest bench --config vitest.config.bench.ts --run
  • Benchmarks validated with codspeed run --mode simulation (all 28 benchmarks measured)
  • TypeScript typecheck passes (vue-tsc --noEmit)
  • No changes to existing tests or source code

@codspeed-hq codspeed-hq bot force-pushed the codspeed-wizard-1774582968264 branch from 221227c to d239c40 Compare March 27, 2026 04:03
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​codspeed/​vitest-plugin@​5.2.0911009893100

View full report

@codspeed-hq
Copy link
Copy Markdown
Contributor Author

codspeed-hq bot commented Mar 27, 2026

Congrats! CodSpeed is installed 🎉

🆕 28 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


ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Open in CodSpeed

@codspeed-hq codspeed-hq bot marked this pull request as ready for review March 27, 2026 04:04
@riderx riderx merged commit 96ae71e into main Mar 27, 2026
14 checks passed
@riderx riderx deleted the codspeed-wizard-1774582968264 branch March 27, 2026 04:09
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant