Skip to content

[HDR-57] Add benchmarks for repository and service layers#47

Merged
aidanpants merged 1 commit into
mainfrom
HDR-57
Apr 14, 2026
Merged

[HDR-57] Add benchmarks for repository and service layers#47
aidanpants merged 1 commit into
mainfrom
HDR-57

Conversation

@jaden5677

Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive Go benchmark suite for the backend, enabling performance measurement at the repository, service, handler, and end-to-end (E2E) HTTP levels. It adds reusable helpers for containerized Postgres databases, E2E test environments, and a variety of benchmarks for the authentication flow. It also updates the Taskfile.yml to provide convenient commands for running these new benchmarks.

Benchmark Infrastructure:

  • Taskfile benchmark commands:
    • Adds new bench:* tasks to Taskfile.yml for running backend, handler, service, repository, and E2E benchmarks, as well as HTTP benchmarks for the scheduler and transcripts services. Also includes aggregate tasks to run all benchmarks together.

Benchmark Helpers:

  • Reusable Postgres test container:
    • Introduces apps/backend/internal/tests/benchmarks/bench_helpers.go, which provides a BenchDB helper for spinning up and managing a Postgres test container (with migrations) for use in benchmarks. Supports both shared and per-benchmark container lifecycles.

Benchmark Suites:

  • E2E authentication benchmarks:

    • Adds apps/backend/internal/tests/benchmarks/e2e/auth_bench_test.go, implementing full-stack HTTP benchmarks for the register, login, and refresh flows, exercising the handler, service, and database layers together.
  • Handler-level benchmarks:

    • Adds apps/backend/internal/tests/benchmarks/handler/auth_bench_test.go, covering isolated handler benchmarks for login, register, refresh, and JWT middleware using mock services.- Implemented benchmarks for schedule and time log repositories to measure performance.
  • Created benchmarks for authentication service, including registration, login, and token validation.

  • Added crypto service benchmarks for encryption and decryption operations.

  • Developed benchmarks for the scheduler service to evaluate schedule generation under various loads.

  • Introduced transcript extraction benchmarks to assess performance with different PDF sizes.

  • Added a Docker Compose file for running benchmarks against the scheduler and transcripts services.

  • Included test data generation scripts for transcript benchmarks.

- Implemented benchmarks for schedule and time log repositories to measure performance.
- Created benchmarks for authentication service, including registration, login, and token validation.
- Added crypto service benchmarks for encryption and decryption operations.
- Developed benchmarks for the scheduler service to evaluate schedule generation under various loads.
- Introduced transcript extraction benchmarks to assess performance with different PDF sizes.
- Added a Docker Compose file for running benchmarks against the scheduler and transcripts services.
- Included test data generation scripts for transcript benchmarks.
@jaden5677 jaden5677 requested a review from aidanpants April 14, 2026 05:52
@jaden5677 jaden5677 self-assigned this Apr 14, 2026
Copilot AI review requested due to automatic review settings April 14, 2026 05:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a benchmark suite across the backend (repository/service/handler/E2E) plus HTTP benchmarks for the scheduler and transcripts services, with supporting tooling to run them consistently.

Changes:

  • Introduces Go benchmark helpers for containerized Postgres (testcontainers + migrations) and adds backend benchmarks for auth, crypto, schedule, and timelog layers.
  • Adds HTTP-level benchmark modules for scheduler and transcripts Python services, including fixture guidance and a compose file to run targets locally.
  • Extends Taskfile.yml with bench:* tasks to run benchmark subsets and aggregated runs.

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
tests/benchmarks/transcripts/transcripts_bench_test.go HTTP benchmarks for transcripts service health + extract endpoints (incl. concurrent).
tests/benchmarks/transcripts/testdata/README.md Instructions for generating PDF fixtures used by transcript benchmarks.
tests/benchmarks/scheduler/scheduler_bench_test.go HTTP benchmarks for scheduler health + schedule generation (incl. concurrent + varying sizes).
tests/benchmarks/go.mod Separate Go module for scheduler/transcripts HTTP benchmarks.
docker-compose.bench.yml Compose file to run scheduler/transcripts services for HTTP benchmarking.
apps/frontend/src/routeTree.gen.ts Regenerated router tree output (formatting/no functional benchmark impact).
apps/frontend/src/features/student/components/banking-details-form.tsx Formatting-only change in the banking details form component.
apps/backend/internal/tests/benchmarks/service/crypto_bench_test.go Benchmarks for crypto encrypt/decrypt/round-trip helpers.
apps/backend/internal/tests/benchmarks/service/auth_bench_test.go Service-layer benchmarks for auth register/login/token validation (mocked repos).
apps/backend/internal/tests/benchmarks/repository/timelog_bench_test.go Repository benchmarks for timelog CRUD/list operations using BenchDB.
apps/backend/internal/tests/benchmarks/repository/schedule_bench_test.go Repository benchmarks for schedules and shift templates, incl. large JSON payload case.
apps/backend/internal/tests/benchmarks/repository/auth_bench_test.go Repository benchmarks for user, refresh token, and auth token persistence flows.
apps/backend/internal/tests/benchmarks/handler/auth_bench_test.go Handler-level benchmarks for auth endpoints + JWT middleware with mock service.
apps/backend/internal/tests/benchmarks/e2e/auth_bench_test.go Full-stack E2E benchmarks for register/login/refresh against real DB + handler stack.
apps/backend/internal/tests/benchmarks/bench_helpers.go Shared/dedicated Postgres benchmark container helper + table cleanup utility.
Taskfile.yml Adds bench:* tasks to run backend and service HTTP benchmarks (plus aggregate tasks).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/backend/internal/tests/benchmarks/e2e/auth_bench_test.go
Comment thread Taskfile.yml
Comment thread tests/benchmarks/transcripts/transcripts_bench_test.go
Comment thread tests/benchmarks/transcripts/testdata/README.md
Comment thread apps/backend/internal/tests/benchmarks/e2e/auth_bench_test.go
@aidanpants aidanpants merged commit 7fcd170 into main Apr 14, 2026
13 checks passed
@aidanpants aidanpants deleted the HDR-57 branch April 14, 2026 06:04
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.

3 participants