rhailib/BENCHMARK_README.md
2025-06-12 05:21:52 +03:00

2.7 KiB

Rhailib Benchmarking - SIMPLIFIED

Note

: This document describes the old complex benchmarking system. For the new minimal system, see bench/README.md

🎯 New Minimal Benchmark System

The benchmarking system has been drastically simplified:

  • 85% Code Reduction: From 800+ lines to ~113 lines
  • Single File: All logic in bench/simple_bench.rs
  • Direct Timing: Redis timestamps, no complex stats
  • Minimal Dependencies: No criterion, no abstractions

Quick Start

cd bench
cargo run --bin simple_bench

Expected Output

🧹 Cleaning up Redis...
🚀 Starting worker...
📝 Creating single task...
⏱️  Waiting for completion...
✅ Task completed in 23.45ms
🧹 Cleaning up...

📁 New Structure

rhailib/
├── bench/                    # NEW: Minimal benchmark system
│   ├── simple_bench.rs       # Main benchmark (85 lines)
│   ├── batch_task.lua        # Simple task creation (28 lines)
│   ├── Cargo.toml           # Dependencies
│   └── README.md            # Usage instructions
└── scripts/                 # Cleaned up scripts
    ├── run_rhai_batch.lua   # Original batch script (kept)
    └── run_rhai.lua         # Basic script (kept)

🗑️ What Was Removed

  • benches/ directory (complex criterion-based benchmarks)
  • src/benchmarks/ module (redis_stats.rs, worker_manager.rs)
  • Complex Lua scripts (run_rhai_with_wait.lua, run_rhai_blocking.sh)
  • Framework dependencies (criterion, complex stats)

🚀 Benefits of New System

  1. Minimalism: Single file, linear flow
  2. Direct Timing: updated_at - created_at from Redis
  3. Easy to Understand: No abstractions or frameworks
  4. Fast to Modify: 85 lines vs 800+ lines
  5. Reliable: Simple Redis operations
  6. Extensible: Easy to add features incrementally

📈 Iteration Plan

  • Current: Single task (n=1) benchmarking
  • Next: Small batches (n=5, n=10)
  • Future: Larger batches and script complexity

📚 Old System Documentation (Archived)

The following describes the previous complex system that has been removed:

Old Architecture (REMOVED)

  • Complex Criterion-based benchmarking
  • Multi-module statistics collection
  • Abstract worker management
  • Complex configuration systems
  • Framework dependencies

Old Files (REMOVED)

  • benches/rhai_performance_bench.rs (237 lines)
  • src/benchmarks/redis_stats.rs (285 lines)
  • src/benchmarks/worker_manager.rs (~200 lines)
  • src/benchmarks/mod.rs (10 lines)

Total removed: ~800+ lines of complex code


For current benchmarking, use the new minimal system in bench/