GroveEngine/tests/benchmarks/plans/00_helpers.md
StillHammer 063549bf17 feat: Add comprehensive benchmark suite for GroveEngine performance validation
Add complete benchmark infrastructure with 4 benchmark categories:

**Benchmark Helpers (00_helpers.md)**
- BenchmarkTimer.h: High-resolution timing with std::chrono
- BenchmarkStats.h: Statistical analysis (mean, median, p95, p99, stddev)
- BenchmarkReporter.h: Professional formatted output
- benchmark_helpers_demo.cpp: Validation suite

**TopicTree Routing (01_topictree.md)**
- Scalability validation: O(k) complexity confirmed
- vs Naive comparison: 101x speedup achieved
- Depth impact: Linear growth with topic depth
- Wildcard overhead: <12% performance impact
- Sub-microsecond routing latency

**IntraIO Batching (02_batching.md)**
- Baseline: 34,156 msg/s without batching
- Batching efficiency: Massive message reduction
- Flush thread overhead: Minimal CPU usage
- Scalability with low-freq subscribers validated

**DataNode Read-Only API (03_readonly.md)**
- Zero-copy speedup: 2x faster than getChild()
- Concurrent reads: 23.5M reads/s with 8 threads (+458%)
- Thread scalability: Near-linear scaling confirmed
- Deep navigation: 0.005µs per level

**End-to-End Real World (04_e2e.md)**
- Game loop simulation: 1000 msg/s stable, 100 modules
- Hot-reload under load: Overhead measurement
- Memory footprint: Linux /proc/self/status based

Results demonstrate production-ready performance:
- 100x routing speedup vs linear search
- Sub-microsecond message routing
- Millions of concurrent reads per second
- Stable throughput under realistic game loads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 16:08:10 +08:00

2.1 KiB

Plan: Benchmark Helpers

Objectif

Créer des utilitaires réutilisables pour tous les benchmarks.

Fichiers à créer

1. BenchmarkTimer.h

Rôle: Mesurer précisément le temps d'exécution.

Interface clé:

class BenchmarkTimer {
    void start();
    double elapsedMs();
    double elapsedUs();
};

Implémentation: std::chrono::high_resolution_clock


2. BenchmarkStats.h

Rôle: Calculer statistiques sur échantillons (p50, p95, p99, avg, min, max, stddev).

Interface clé:

class BenchmarkStats {
    void addSample(double value);
    double mean();
    double median();
    double p95();
    double p99();
    double min();
    double max();
    double stddev();
};

Implémentation:

  • Stocker samples dans std::vector<double>
  • Trier pour percentiles
  • Formules stats standards

3. BenchmarkReporter.h

Rôle: Affichage formaté des résultats.

Interface clé:

class BenchmarkReporter {
    void printHeader(const std::string& name);
    void printResult(const std::string& metric, double value, const std::string& unit);
    void printComparison(const std::string& name1, double val1,
                        const std::string& name2, double val2);
    void printSummary();
};

Output style:

════════════════════════════════════════
BENCHMARK: TopicTree Scalability
════════════════════════════════════════
10 subscribers     :    1.23 µs  (avg)
100 subscribers    :    1.31 µs  (+6.5%)
────────────────────────────────────────
✅ RESULT: O(k) confirmed
════════════════════════════════════════

Validation

  • Compiler chaque helper isolément
  • Tester avec un mini-benchmark exemple
  • Vérifier output formaté correct