Files
foxhunt/scripts/benchmark_nextest.sh
jgrusewski 8d89fe80ff chore: Second cleanup wave - organize root directory
- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/
- Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root)
- Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/
- Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts
- Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries)
- Tests: Move 14 .rs files → tests/standalone/
- SQL: Move 5 files → sql/ (keep init-db*.sql for Docker)
- Wave 153: Archive to docs/archive/historical/wave153/
- Docs: Archive 9 markdown files to wave_d/reports/ and historical/

Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files
Directory count reduced from 65 to 31 (52% reduction)
All historical data preserved in organized archive structure
2025-10-30 01:26:02 +01:00

80 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Benchmark script to compare cargo test vs cargo nextest
# Usage: ./benchmark_nextest.sh
set -e
PACKAGE="common"
TEST_FILTER="test_"
echo "================================"
echo "Cargo Test vs Nextest Benchmark"
echo "================================"
echo "Package: $PACKAGE"
echo "Test filter: $TEST_FILTER"
echo ""
# Clean build to ensure fair comparison
echo "[1/5] Cleaning build artifacts..."
cargo clean -p $PACKAGE
echo ""
# Build with regular cargo test
echo "[2/5] Building with 'cargo test' (no run)..."
start_time=$(date +%s.%N)
cargo test --package $PACKAGE --lib --no-run 2>&1 | tail -3
end_time=$(date +%s.%N)
cargo_test_build_time=$(echo "$end_time - $start_time" | bc)
echo "Cargo test build time: ${cargo_test_build_time}s"
echo ""
# Run with regular cargo test
echo "[3/5] Running tests with 'cargo test'..."
start_time=$(date +%s.%N)
cargo test --package $PACKAGE --lib $TEST_FILTER 2>&1 | tail -5
end_time=$(date +%s.%N)
cargo_test_run_time=$(echo "$end_time - $start_time" | bc)
echo "Cargo test run time: ${cargo_test_run_time}s"
echo ""
# Clean again for nextest
echo "[4/5] Cleaning for nextest comparison..."
cargo clean -p $PACKAGE
echo ""
# Build and run with nextest
echo "[5/5] Building and running with 'cargo nextest'..."
start_time=$(date +%s.%N)
cargo nextest run --package $PACKAGE --lib $TEST_FILTER 2>&1 | tail -10
end_time=$(date +%s.%N)
nextest_total_time=$(echo "$end_time - $start_time" | bc)
echo "Nextest total time (build + run): ${nextest_total_time}s"
echo ""
# Summary
echo "================================"
echo "SUMMARY"
echo "================================"
echo "cargo test:"
echo " - Build time: ${cargo_test_build_time}s"
echo " - Run time: ${cargo_test_run_time}s"
echo " - Total: $(echo "$cargo_test_build_time + $cargo_test_run_time" | bc)s"
echo ""
echo "cargo nextest:"
echo " - Total time: ${nextest_total_time}s"
echo ""
cargo_total=$(echo "$cargo_test_build_time + $cargo_test_run_time" | bc)
speedup=$(echo "scale=2; $cargo_total / $nextest_total_time" | bc)
if (( $(echo "$speedup > 1" | bc -l) )); then
echo "✅ nextest is ${speedup}x faster!"
elif (( $(echo "$speedup < 1" | bc -l) )); then
slowdown=$(echo "scale=2; $nextest_total_time / $cargo_total" | bc)
echo "⚠️ nextest is ${slowdown}x slower"
else
echo "⚡ Performance is equivalent"
fi
echo ""