-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyze_performance.py
More file actions
69 lines (55 loc) · 2.56 KB
/
Copy pathanalyze_performance.py
File metadata and controls
69 lines (55 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
"""
Focused performance analysis for update_repository_tree_with_branch_filter
"""
import sys
import os
sys.path.append(os.path.dirname(__file__))
from git_repository_manager import GitRepositoryManager, BENCHMARKING_ENABLED
import tkinter as tk
def analyze_performance():
"""Analyze the performance of the slow method"""
print("🔍 Performance Analysis for update_repository_tree_with_branch_filter")
print("=" * 70)
# Create a non-visible instance for testing
root = tk.Tk()
root.withdraw() # Hide the window
app = GitRepositoryManager()
if not app.selected_folder:
print("❌ No folder selected. The performance test needs repositories to analyze.")
print("💡 Please modify this script to set app.selected_folder to a folder with Git repositories.")
print("💡 Or run the full application and use Debug > Profile Branch Filtering")
root.destroy()
return
print(f"📁 Analyzing folder: {app.selected_folder}")
print(f"📊 Found {len(app.repositories)} repositories")
if len(app.repositories) == 0:
print("❌ No repositories found. Please ensure the folder contains Git repositories.")
root.destroy()
return
# Test different filter scenarios
test_scenarios = [
("No filters", "", ""),
("User filter", "test", ""),
("Message filter", "", "fix"),
("Combined filters", "test", "fix"),
]
print(f"\n🧪 Testing {len(test_scenarios)} scenarios...")
for scenario_name, user_filter, message_filter in test_scenarios:
print(f"\n--- {scenario_name} ---")
app.branch_filter_user = user_filter
app.branch_filter_message = message_filter
if user_filter or message_filter:
print(f"Filters: user='{user_filter}', message='{message_filter}'")
app.update_repository_tree_with_branch_filter()
else:
print("No filters applied - skipping (would show all repositories)")
root.destroy()
print("\n✅ Performance analysis completed!")
print("\n💡 Tips for improving performance:")
print("1. Look for repositories that consistently take >100ms")
print("2. Consider caching branch information for large repositories")
print("3. Implement lazy loading for repositories with many branches")
print("4. Use more specific filters to reduce the number of branches to check")
if __name__ == "__main__":
analyze_performance()