ruvector/examples/edge-net/run-benchmarks.sh
rUv 890ff45075 feat(wasm): add 5 exotic AI WASM packages with npm publishing
WASM Packages (published to npm as @ruvector/*):
- learning-wasm (39KB): MicroLoRA rank-2 adaptation with <100us latency
- economy-wasm (182KB): CRDT-based autonomous credit economy
- exotic-wasm (150KB): NAO governance, Time Crystals, Morphogenetic Networks
- nervous-system-wasm (178KB): HDC, BTSP, WTA, Global Workspace
- attention-unified-wasm (339KB): 18+ attention mechanisms (Neural, DAG, Graph, Mamba)

Changes:
- Add ruvector-attention-unified-wasm crate with unified attention API
- Add ruvector-economy-wasm crate with CRDT ledger and reputation
- Add ruvector-exotic-wasm crate with emergent AI mechanisms
- Add ruvector-learning-wasm crate with MicroLoRA adaptation
- Add ruvector-nervous-system-wasm crate with bio-inspired components
- Fix ruvector-dag for WASM compatibility (feature flags)
- Add exotic AI capabilities to edge-net example
- Update README with WASM documentation
- Include pkg/ directories with built WASM bundles

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 06:31:11 +00:00

88 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
# Edge-Net Performance Benchmark Runner
# Usage: ./run-benchmarks.sh [--baseline|--compare|--profile]
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "========================================"
echo "Edge-Net Performance Benchmark Suite"
echo "========================================"
echo ""
# Check if cargo bench is available
if ! command -v cargo &> /dev/null; then
echo "Error: cargo not found. Please install Rust toolchain."
exit 1
fi
# Parse arguments
MODE="run"
if [ "$1" == "--baseline" ]; then
MODE="baseline"
elif [ "$1" == "--compare" ]; then
MODE="compare"
elif [ "$1" == "--profile" ]; then
MODE="profile"
fi
case $MODE in
baseline)
echo "Creating performance baseline..."
cargo bench --features=bench 2>&1 | tee benchmarks-baseline.txt
echo ""
echo "✅ Baseline saved to: benchmarks-baseline.txt"
;;
compare)
if [ ! -f "benchmarks-baseline.txt" ]; then
echo "Error: No baseline found. Run with --baseline first."
exit 1
fi
echo "Running benchmarks and comparing with baseline..."
cargo bench --features=bench 2>&1 | tee benchmarks-current.txt
echo ""
echo "Comparison Report:"
echo "=================="
echo "Baseline file: benchmarks-baseline.txt"
echo "Current file: benchmarks-current.txt"
echo ""
echo "To compare, install cargo-benchcmp:"
echo " cargo install cargo-benchcmp"
echo " cargo benchcmp benchmarks-baseline.txt benchmarks-current.txt"
;;
profile)
echo "Running with profiling (flamegraph)..."
if ! command -v cargo-flamegraph &> /dev/null; then
echo "Installing cargo-flamegraph..."
cargo install flamegraph
fi
cargo flamegraph --bench benchmarks --features=bench
echo ""
echo "✅ Flamegraph saved to: flamegraph.svg"
echo "Open with: firefox flamegraph.svg (or your browser)"
;;
*)
echo "Running all benchmarks..."
echo ""
cargo bench --features=bench
echo ""
echo "✅ Benchmarks complete!"
echo ""
echo "Usage:"
echo " ./run-benchmarks.sh # Run benchmarks"
echo " ./run-benchmarks.sh --baseline # Save baseline"
echo " ./run-benchmarks.sh --compare # Compare with baseline"
echo " ./run-benchmarks.sh --profile # Generate flamegraph"
;;
esac
echo ""
echo "Performance reports available:"
echo " - PERFORMANCE_ANALYSIS.md"
echo " - OPTIMIZATIONS_APPLIED.md"
echo " - OPTIMIZATION_SUMMARY.md"