Implement baseline benchmarks for Task T001 (Phase 3.1)#57
Implement baseline benchmarks for Task T001 (Phase 3.1)#57Copilot wants to merge 2 commits into001-baseline-specification-forfrom
Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements baseline performance benchmarks for the modular framework to establish performance metrics before upcoming dynamic reload and health aggregator features. The implementation provides three key benchmarks measuring application lifecycle, service lookup, and configuration loading performance.
- Adds comprehensive benchmarks for application bootstrap (~11-12μs), service registry lookup (~640-680ns), and config loading (~5-6ns)
- Creates infrastructure with build constraints to exclude benchmarks from normal builds
- Establishes performance baseline for tracking regressions during future development phases
| // Register N dummy services | ||
| registry := app.SvcRegistry() | ||
| for i := 0; i < numServices; i++ { | ||
| serviceName := "service-" + string(rune('0'+i%10)) + string(rune('0'+(i/10)%10)) |
There was a problem hiding this comment.
The service name generation logic is unnecessarily complex and hard to understand. Consider using fmt.Sprintf(\"service-%02d\", i) for clearer intent and better readability.
| // Service names to lookup during benchmark | ||
| lookupNames := make([]string, numServices) | ||
| for i := 0; i < numServices; i++ { | ||
| lookupNames[i] = "service-" + string(rune('0'+i%10)) + string(rune('0'+(i/10)%10)) |
There was a problem hiding this comment.
This duplicates the complex service name generation logic from line 136. Extract this into a helper function like generateServiceName(i int) string to eliminate code duplication and improve maintainability.
This PR implements Task T001 from
specs/001-baseline-specification-for/tasks.mdto establish baseline performance metrics for the modular framework prior to dynamic reload and health aggregator changes.Implementation
Creates
internal/benchmark/benchmark_baseline_test.gowith three core benchmarks:BenchmarkApplicationBootstrap
Measures application lifecycle performance including module registration, initialization, startup, and shutdown. Uses minimal mock modules to focus on framework overhead:
BenchmarkServiceLookup
Tests service registry performance with realistic workloads:
BenchmarkConfigLoad
Measures configuration provider creation and validation:
Key Features
//go:build plannedtag to exclude benchmarks from normal buildsVerification
The benchmarks provide a performance baseline for tracking regressions during upcoming feature development phases (T031+ dynamic reload and health aggregation implementations).
No production code changes - only adds benchmark infrastructure as specified.
Created from VS Code via the GitHub Pull Request extension.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.