Classes
SuggestionType
Types of performance suggestions.
SuggestionType
Types of performance suggestions.
Enum
SuggestionPriority
Priority levels for suggestions.
SuggestionPriority
Priority levels for suggestions.
Enum
PerformanceSuggestion
dataclass
A single performance improvement suggestion.
Represents an actionable recommendation to improve bu…
PerformanceSuggestion
dataclass A single performance improvement suggestion.
Represents an actionable recommendation to improve build performance, with estimated impact and configuration examples.
Attributes
| Name | Type | Description |
|---|---|---|
type |
SuggestionType |
Category of suggestion (BUILD, CONTENT, CONFIG, etc.) |
priority |
SuggestionPriority |
Priority level (HIGH, MEDIUM, LOW) |
title |
str |
Short title of the suggestion |
description |
str |
Detailed explanation of the issue |
impact |
str |
Estimated performance impact (e.g., "Could save ~2.5s") |
action |
str |
What the user should do to implement this suggestion |
config_example |
str | None |
Optional example configuration change |
Internal Methods 1
__str__
Format suggestion for display.
__str__
def __str__(self) -> str
Format suggestion for display.
Returns
str
PerformanceGrade
dataclass
Overall performance assessment for a build.
Provides a letter grade (A-F) and category assessment …
PerformanceGrade
dataclass Overall performance assessment for a build.
Provides a letter grade (A-F) and category assessment based on build performance metrics and best practices compliance.
Attributes
| Name | Type | Description |
|---|---|---|
grade |
str |
Letter grade (A, B, C, D, or F) |
score |
int |
Numeric score (0-100) |
category |
str |
Performance category ("Excellent", "Good", "Fair", "Poor", "Critical") |
summary |
str |
One-line summary of performance assessment |
Methods 1
calculate
classmethod
Calculate performance grade based on build statistics.
Scoring factors:
- Buil…
calculate
classmethod def calculate(cls, stats: BuildStats) -> PerformanceGrade
Calculate performance grade based on build statistics.
Scoring factors:
- Build speed (pages/second)
- Time distribution (balanced vs bottlenecked)
- Cache effectiveness (if incremental)
- Resource usage
Parameters 1
stats |
BuildStats |
Returns
PerformanceGrade
PerformanceAdvisor
Analyzes build performance and provides intelligent suggestions.
Uses build statistics to identify…
PerformanceAdvisor
Analyzes build performance and provides intelligent suggestions.
Uses build statistics to identify bottlenecks and recommend optimizations tailored to the specific project.
Methods 5
analyze
Analyze build and generate suggestions.
analyze
def analyze(self) -> list[PerformanceSuggestion]
Analyze build and generate suggestions.
Returns
List of suggestions, ordered by prioritylist[PerformanceSuggestion]
—
get_grade
Get overall performance grade.
get_grade
def get_grade(self) -> PerformanceGrade
Get overall performance grade.
Returns
PerformanceGrade with score and categoryPerformanceGrade
—
get_bottleneck
Identify the primary bottleneck phase.
get_bottleneck
def get_bottleneck(self) -> str | None
Identify the primary bottleneck phase.
Returns
Name of slowest phase, or None if well-balancedstr | None
—
get_top_suggestions
Get top N suggestions.
get_top_suggestions
def get_top_suggestions(self, limit: int = 3) -> list[PerformanceSuggestion]
Get top N suggestions.
Parameters 1
limit |
int |
Maximum number of suggestions to return |
Returns
Up tolist[PerformanceSuggestion]
— limithighest-priority suggestions
format_summary
Format a text summary of analysis.
format_summary
def format_summary(self) -> str
Format a text summary of analysis.
Returns
Multi-line string with analysis summarystr
—
Internal Methods 7
__init__
Initialize performance advisor.
__init__
def __init__(self, stats: BuildStats, environment: dict[str, Any] | None = None)
Initialize performance advisor.
Parameters 2
stats |
BuildStats |
Build statistics to analyze |
environment |
dict[str, Any] | None |
Environment info from rich_console.detect_environment() |
_check_parallel_opportunity
Check if parallel builds would help.
_check_parallel_opportunity
def _check_parallel_opportunity(self) -> None
Check if parallel builds would help.
_check_incremental_opportunity
Check if incremental builds would help.
_check_incremental_opportunity
def _check_incremental_opportunity(self) -> None
Check if incremental builds would help.
_check_rendering_bottleneck
Check if rendering is a bottleneck.
_check_rendering_bottleneck
def _check_rendering_bottleneck(self) -> None
Check if rendering is a bottleneck.
_check_asset_optimization
Check asset processing performance.
_check_asset_optimization
def _check_asset_optimization(self) -> None
Check asset processing performance.
_check_memory_usage
Check memory usage and suggest optimizations.
_check_memory_usage
def _check_memory_usage(self) -> None
Check memory usage and suggest optimizations.
_check_template_complexity
Check for template complexity issues.
_check_template_complexity
def _check_template_complexity(self) -> None
Check for template complexity issues.
Functions
analyze_build
Quick analysis of build statistics.
analyze_build
def analyze_build(stats: BuildStats, environment: dict[str, Any] | None = None) -> PerformanceAdvisor
Quick analysis of build statistics.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
stats |
BuildStats |
— | Build statistics |
environment |
dict[str, Any] | None |
None |
Optional environment info |
Returns
PerformanceAdvisor with analysis completePerformanceAdvisor
—