[HDR-57] Add benchmarks for repository and service layers#47
Merged
Conversation
- 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.
Contributor
There was a problem hiding this comment.
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.ymlwithbench:*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.
aidanpants
approved these changes
Apr 14, 2026
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.
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.ymlto provide convenient commands for running these new benchmarks.Benchmark Infrastructure:
bench:*tasks toTaskfile.ymlfor 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:
apps/backend/internal/tests/benchmarks/bench_helpers.go, which provides aBenchDBhelper 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:
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:
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.