Comprehensive benchmark suite for validating all performance targets in Agentic-Flow v2.0.0-alpha.
npm install# Run all benchmarks
npm run benchmark
# Run specific benchmark suite
npm run benchmark:vector-search
npm run benchmark:agent-operations
npm run benchmark:memory
npm run benchmark:task-orchestration
npm run benchmark:attention
npm run benchmark:gnnnpm run benchmark:reportOpen benchmarks/reports/benchmark-report.html in your browser.
benchmarks/
├── src/ # Benchmark implementations
│ ├── vector-search.bench.ts # Vector search benchmarks
│ ├── agent-operations.bench.ts # Agent spawn/lifecycle benchmarks
│ ├── memory-operations.bench.ts # Memory insert/retrieve benchmarks
│ ├── task-orchestration.bench.ts# Task orchestration benchmarks
│ ├── attention.bench.ts # Attention mechanism benchmarks
│ ├── gnn.bench.ts # GNN forward pass benchmarks
│ └── regression.bench.ts # Regression detection (v1.0 vs v2.0)
├── utils/ # Benchmark utilities
│ ├── benchmark.ts # Core benchmark runner
│ └── report-generator.ts # HTML report generator
├── data/ # Benchmark data
│ ├── baseline-v1.0.json # v1.0 baseline results
│ └── results-v2.0.json # v2.0 current results
├── reports/ # Generated reports
│ └── benchmark-report.html # Interactive HTML report
└── README.md # This file
Tests vector search performance across different database sizes:
- 1K vectors: <1ms P50 target
- 10K vectors: <5ms P50 target
- 100K vectors: <8ms P50 target
- 1M vectors: <10ms P50 target
Features tested:
- HNSW index performance
- Distance metrics (cosine, euclidean, dot product)
- Variable k (number of nearest neighbors)
- Cache effectiveness
npm run benchmark:vector-searchTests agent lifecycle and coordination:
- Agent spawn: <10ms P50 target
- Task execution: Measures throughput
- Multi-agent coordination: Scalability testing
- Agent memory operations: Store/retrieve/search
- Full lifecycle: Spawn → execute → destroy
npm run benchmark:agent-operationsTests memory store performance:
- Insert: <2ms P50 target (125x faster)
- Retrieval: <1ms P50 target
- Search: Performance with varying result sets
- Update: In-place updates
- Delete: Deletion with index cleanup
- Batch operations: Bulk insert/update
- Concurrent operations: Parallel access patterns
npm run benchmark:memoryTests task scheduling and coordination:
- Orchestration: <50ms P50 target (5x faster)
- Scalability: 10 to 1000 tasks
- Dependency resolution: Complex task graphs
- Priority scheduling: Priority-based task assignment
npm run benchmark:task-orchestrationTests attention mechanism performance:
- Self-attention: <20ms P50 for 512 tokens
- Variable sequence lengths: 64, 128, 256, 512, 1024 tokens
- Batch processing: Multiple sequences
- Hyperbolic attention: Performance comparison
npm run benchmark:attentionTests Graph Neural Network performance:
- Forward pass: <50ms P50 target
- Variable graph sizes: 100 to 10,000 nodes
- Message passing: Multi-hop aggregation
- Graph types: Random, scale-free, small-world
npm run benchmark:gnnCompares v2.0 performance against v1.0 baseline:
npm run benchmark:regressionFeatures:
- Automated regression detection
- Threshold-based alerts (10% regression tolerance)
- Detailed comparison reports
- Historical trend analysis
The benchmark utility provides a high-precision timer and statistical analysis:
import { benchmark } from './utils/benchmark';
const result = await benchmark(
async () => {
// Your code to benchmark
},
{
iterations: 1000, // Number of iterations
warmup: 100, // Warmup iterations
name: 'my-bench', // Benchmark name
silent: false, // Suppress console output
minSamples: 5, // Minimum samples required
maxTime: 30000, // Max time in ms (30s)
}
);
// Results include:
console.log(result.p50); // 50th percentile (median)
console.log(result.p95); // 95th percentile
console.log(result.p99); // 99th percentile
console.log(result.mean); // Mean latency
console.log(result.stdDev);// Standard deviation
console.log(result.opsPerSecond); // ThroughputBenchmarks run automatically on:
- Pull requests (regression detection)
- Main branch commits (baseline updates)
- Nightly (comprehensive suite)
# .github/workflows/benchmarks.yml
name: Performance Benchmarks
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '0 0 * * *' # Daily at midnight
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run benchmarks
run: npm run benchmark
- name: Check regressions
run: npm run benchmark:regression
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: benchmarks/data/results-v2.0.json- P50 (Median): 50% of operations complete within this time
- P95: 95% of operations complete within this time
- P99: 99% of operations complete within this time
- P99.9: 99.9% of operations complete within this time
- ✅ PASS: Performance meets or exceeds target
- ❌ FAIL: Performance below target threshold
⚠️ WARNING: Performance within 10% of target
- Acceptable: <10% slower than baseline
- Warning: 10-20% slower than baseline
- Critical: >20% slower than baseline
- Consistent Environment: Run benchmarks on dedicated hardware
- Warmup: Always include warmup iterations to eliminate JIT effects
- Sample Size: Use sufficient iterations for statistical significance
- Isolation: Close unnecessary applications during benchmarking
- Multiple Runs: Run benchmarks multiple times and compare results
- Baseline Updates: Update baseline after verified improvements
# Run with more iterations
npm run benchmark -- --iterations=10000
# Run multiple times and average
for i in {1..5}; do npm run benchmark; done# Increase Node.js memory limit
NODE_OPTIONS="--max-old-space-size=8192" npm run benchmark# Run with reduced iterations for quick validation
npm run benchmark -- --quickWhen adding new benchmarks:
- Follow existing benchmark structure
- Include performance targets with rationale
- Add comprehensive documentation
- Update CI/CD workflows
- Include regression tests
MIT License - see LICENSE file for details
- Issues: https://github.com/ruvnet/agentic-flow/issues
- Discussions: https://github.com/ruvnet/agentic-flow/discussions
- Documentation: https://docs.agentic-flow.dev
