mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-16 13:08:03 +00:00
Adjust performance thresholds for dev environment
- Add --avatar-threshold parameter to performance tests - Set dev environment threshold to 2500ms (vs 1000ms for prod) - Dev environments are expected to be slower due to resource constraints - Production keeps strict 1000ms threshold for optimal performance
This commit is contained in:
@@ -831,7 +831,7 @@ class PerformanceTestRunner:
|
||||
|
||||
return first_duration, second_duration
|
||||
|
||||
def run_all_tests(self) -> Optional[Dict[str, Any]]:
|
||||
def run_all_tests(self, avatar_threshold: int = 1000) -> Optional[Dict[str, Any]]:
|
||||
"""Run all performance tests"""
|
||||
print("Starting Libravatar Performance Tests")
|
||||
print("=" * 50)
|
||||
@@ -865,7 +865,7 @@ class PerformanceTestRunner:
|
||||
print(f"Performance tests completed in {total_duration:.2f}s")
|
||||
|
||||
# Overall assessment
|
||||
self.assess_overall_performance()
|
||||
self.assess_overall_performance(avatar_threshold)
|
||||
|
||||
return self.results
|
||||
|
||||
@@ -928,7 +928,7 @@ class PerformanceTestRunner:
|
||||
"success_rate": len(successful_results) / len(results) if results else 0,
|
||||
}
|
||||
|
||||
def assess_overall_performance(self) -> bool:
|
||||
def assess_overall_performance(self, avatar_threshold: int = 1000) -> bool:
|
||||
"""Provide overall performance assessment"""
|
||||
print("\n=== OVERALL PERFORMANCE ASSESSMENT ===")
|
||||
|
||||
@@ -937,8 +937,8 @@ class PerformanceTestRunner:
|
||||
# Check avatar generation
|
||||
if "avatar_generation" in self.results:
|
||||
avg_gen = self.results["avatar_generation"]["average_ms"]
|
||||
if avg_gen > 1000:
|
||||
warnings.append(f"Avatar generation is slow ({avg_gen:.0f}ms average)")
|
||||
if avg_gen > avatar_threshold:
|
||||
warnings.append(f"Avatar generation is slow ({avg_gen:.0f}ms average, threshold: {avatar_threshold}ms)")
|
||||
|
||||
# Check concurrent load
|
||||
if "concurrent_load" in self.results:
|
||||
@@ -1000,6 +1000,12 @@ def main() -> Optional[Dict[str, Any]]:
|
||||
action="store_true",
|
||||
help="Force remote testing mode (auto-detected for non-localhost URLs)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--avatar-threshold",
|
||||
type=int,
|
||||
default=1000,
|
||||
help="Avatar generation threshold in ms (default: 1000ms, use 2500 for dev environments)",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -1016,7 +1022,7 @@ def main() -> Optional[Dict[str, Any]]:
|
||||
remote_testing=remote_testing,
|
||||
)
|
||||
|
||||
results = runner.run_all_tests()
|
||||
results = runner.run_all_tests(args.avatar_threshold)
|
||||
|
||||
if args.output and results:
|
||||
import json
|
||||
|
||||
Reference in New Issue
Block a user