test(performance): add cold start benchmarking infrastructure#467
Merged
test(performance): add cold start benchmarking infrastructure#467
Conversation
Add comprehensive tooling to measure and compare cold start performance across different branches and code changes. Changes: - Add test_cold_start.py: measures import times, module counts, and lazy loading status with 10 iterations per measurement - Add benchmark_cold_start.sh: automates running benchmarks on different git branches with stash/restore logic - Add compare_benchmarks.py: analyzes and visualizes differences between two benchmark runs with colored output - Add benchmark_results/ to .gitignore: exclude generated JSON data The benchmark suite validates: - Import time for runpod, runpod.serverless, and runpod.endpoint - Total module count and runpod-specific module count - Whether paramiko and SSH CLI modules are eagerly or lazy-loaded - Performance regression detection (fails if import > 1000ms) Usage: # Run on current branch uv run pytest tests/test_performance/test_cold_start.py # Compare two branches ./scripts/benchmark_cold_start.sh main feature-branch Results saved to benchmark_results/ as timestamped JSON files for historical comparison and CI/CD integration.
Add detailed README for cold start benchmarking tools covering: - Quick start examples for common use cases - Tool documentation with usage patterns and output examples - Result file structure and naming conventions - Performance targets and interpretation guidance - CI/CD integration examples - Troubleshooting common issues The guide enables developers to effectively measure, compare, and validate cold start performance improvements across code changes.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive cold start benchmarking infrastructure to measure and compare import performance of the runpod package across different branches and code changes. The tooling helps identify performance regressions and validate optimizations like lazy loading.
Key changes:
- Adds automated benchmarking test suite for measuring import times, module counts, and lazy loading behavior
- Provides comparison tooling with visual diff output to analyze performance changes between branches
- Includes shell automation for branch-based benchmarking with safe git operations
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_performance/test_cold_start.py | Core benchmark implementation measuring import times in isolated subprocesses with statistical analysis |
| tests/test_performance/init.py | Package initialization for performance test module |
| scripts/compare_benchmarks.py | Analysis tool comparing two benchmark results with colored terminal output |
| scripts/benchmark_cold_start.sh | Shell automation for running benchmarks across git branches with safe state management |
| scripts/README.md | Comprehensive documentation of benchmarking tools, workflows, and performance targets |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address code review feedback from PR #467: 1. Fix median calculation for even-length lists - Previously only returned single middle value - Now correctly averages the two middle values for even-length lists - Maintains correct behavior for odd-length lists 2. Update usage message to match documented pattern - Changed from "python" to "uv run python scripts/..." - Aligns with project's uv-based tooling conventions - Matches usage examples in README and throughout codebase These fixes improve statistical accuracy and documentation consistency.
jhcipar
approved these changes
Dec 12, 2025
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.
Performance benchmarking tools for measuring and comparing cold start times across different code changes.
Instructions inside scripts/README.md