MCPcopy Create free account
hub / github.com/M4THYOU/TokenDagger / run_benchmarks

Method run_benchmarks

tests/performance_benchmark.py:492–527  ·  view source on GitHub ↗

Run comprehensive benchmark suite.

(self)

Source from the content-addressed store, hash-verified

490 )
491
492 def run_benchmarks(self):
493 """Run comprehensive benchmark suite."""
494 print("="*80)
495 print("TOKENIZER PERFORMANCE BENCHMARK")
496 print("="*80)
497 print(f"Warmup runs: {self.warmup_runs}")
498 print(f"Benchmark runs: {self.benchmark_runs}")
499 print()
500
501 # Generate test corpus
502 print("Generating test corpus...")
503 test_texts = self.generate_test_texts()
504
505 total_tests = sum(len(texts) for texts in test_texts.values())
506 current_test = 0
507
508 # Run benchmarks
509 for category, texts in test_texts.items():
510 print(f"\n--- {category.upper().replace('_', ' ')} ---")
511
512 for i, text in enumerate(texts):
513 current_test += 1
514 test_name = f"{category}_{i}"
515
516 print(f"[{current_test:3d}/{total_tests}] {test_name:<30} "
517 f"({len(text):6d} chars)", end=" ... ", flush=True)
518
519 result = self.benchmark_single_text(test_name, text)
520 self.results.append(result)
521
522 # Print quick result
523 if result.speedup_ratio != float('inf'):
524 speedup_indicator = "🚀" if result.speedup_ratio > 1.5 else "⚡" if result.speedup_ratio > 1.0 else "🐌"
525 print(f"{speedup_indicator} {result.speedup_ratio:.2f}x speedup")
526 else:
527 print("❌ ERROR")
528
529 def print_summary_report(self):
530 """Print comprehensive performance analysis."""

Callers 1

run_full_benchmarkMethod · 0.95

Calls 3

generate_test_textsMethod · 0.95
benchmark_single_textMethod · 0.95
valuesMethod · 0.45

Tested by

no test coverage detected