Performance Tuning
Optimize Vibesweep's performance for large codebases and CI/CD environments.
Performance Basics
Parallel Processing
Vibesweep uses parallel workers by default:
# Use 8 workers (default: CPU cores)
vibesweep analyze . --parallel 8
# Use all available cores
vibesweep analyze . --parallel max
Caching
Enable caching for faster subsequent runs:
# Enable cache (default location: .vibesweep-cache)
vibesweep analyze . --cache
# Custom cache location
vibesweep analyze . --cache-dir /tmp/vibesweep-cache
# Clear cache
vibesweep cache clear
Large Codebase Optimization
File Limits
For initial analysis of huge codebases:
# Analyze only first 1000 files
vibesweep analyze . --max-files 1000
# Focus on specific directories
vibesweep analyze src/ lib/ --exclude "**/test/**"
Incremental Analysis
Analyze only changed files:
# Analyze files changed since last commit
vibesweep analyze . --since HEAD~1
# Analyze files changed in last 7 days
vibesweep analyze . --since "7 days ago"
Memory Management
Configure memory limits:
# Increase Node.js memory limit
NODE_OPTIONS="--max-old-space-size=8192" vibesweep analyze .
# Limit file size for analysis
vibesweep analyze . --max-file-size 1MB
Analysis Speed Optimization
Skip Expensive Checks
# Skip duplication detection (most expensive)
vibesweep analyze . --skip-duplication
# Only run specific analyzers
vibesweep analyze . --only-ai-patterns
Configure Thresholds
In .vibesweeprc.json
:
{
"performance": {
"maxFileSize": "500KB",
"timeout": 30000,
"batchSize": 100
},
"duplication": {
"minTokens": 100, // Increase to reduce checks
"skipBinaries": true
}
}
CI/CD Optimization
GitHub Actions
- name: Vibesweep Analysis
run: |
# Use CI mode for optimized output
npx vibesweep analyze . --ci --parallel max
# Cache between runs
npx vibesweep analyze . --cache-dir ${{ runner.temp }}/vibesweep
Docker Optimization
# Multi-stage build for minimal image
FROM node:18-alpine AS analyzer
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npx vibesweep analyze . --json > results.json
# Final stage with just results
FROM alpine:latest
COPY --from=analyzer /app/results.json .
Monitoring Performance
Timing Analysis
# Show detailed timing information
vibesweep analyze . --verbose --show-timings
# Output:
# ✓ File discovery: 1.2s
# ✓ AST parsing: 4.5s
# ✓ Pattern detection: 2.8s
# ✓ Duplication analysis: 8.3s
# Total: 16.8s
Performance Metrics
{
"debug": {
"showTimings": true,
"showMemoryUsage": true,
"profileOutput": "./vibesweep-profile.json"
}
}
Optimization Strategies
1. Staged Analysis
Run different analyzers separately:
# Stage 1: Quick checks
vibesweep analyze . --only-ai-patterns --fail-fast
# Stage 2: If passed, run expensive checks
vibesweep analyze . --only-duplication
2. Focused Analysis
Target specific concerns:
# Only analyze recently modified files
git diff --name-only main | xargs vibesweep analyze
# Focus on specific file types
vibesweep analyze . --include "**/*.{js,jsx}"
3. Distributed Analysis
For monorepos:
# Analyze packages in parallel
for package in packages/*; do
vibesweep analyze "$package" &
done
wait
Troubleshooting Performance
Common Issues
Out of Memory
# Increase memory and reduce batch size
NODE_OPTIONS="--max-old-space-size=4096" \
vibesweep analyze . --batch-size 50
Slow File System
# Use include patterns instead of exclude
vibesweep analyze . --include "src/**/*.js"
Network Latency
# For remote filesystems, copy first
rsync -av remote:project/ local-copy/
vibesweep analyze local-copy/
Best Practices
- Profile First: Use
--show-timings
to identify bottlenecks - Cache Aggressively: Enable caching in CI/CD
- Parallelize: Use all available CPU cores
- Focus Analysis: Use include/exclude patterns
- Monitor Trends: Track performance over time
Related
- CLI Options - All performance flags
- CI/CD Integration - CI-specific optimization
- Configuration File - Performance settings