Test to establish baseline performance metrics.
()
| 129 | |
| 130 | |
| 131 | def test_baseline_performance(): |
| 132 | """Test to establish baseline performance metrics.""" |
| 133 | print("Establishing B+ Tree Performance Baseline") |
| 134 | print("=" * 50) |
| 135 | |
| 136 | # Test with different tree sizes |
| 137 | sizes = [1000, 10000, 100000] |
| 138 | |
| 139 | for size in sizes: |
| 140 | print(f"\nTree Size: {size:,} items") |
| 141 | print("-" * 30) |
| 142 | |
| 143 | baseline = PerformanceBaseline(tree_size=size) |
| 144 | results = baseline.run_all_tests() |
| 145 | |
| 146 | for test_name, metrics in results.items(): |
| 147 | print(f"\n{test_name.replace('_', ' ').title()}:") |
| 148 | for metric, value in metrics.items(): |
| 149 | if "per_second" in metric: |
| 150 | print(f" {metric}: {value:,.0f}") |
| 151 | elif "ns" in metric: |
| 152 | print(f" {metric}: {value:.1f}") |
| 153 | else: |
| 154 | print(f" {metric}: {value:.4f}s") |
| 155 | |
| 156 | # Save baseline for comparison |
| 157 | print("\n" + "=" * 50) |
| 158 | print("Baseline established. Use these metrics to measure optimization impact.") |
| 159 | |
| 160 | |
| 161 | if __name__ == "__main__": |
no test coverage detected