- Updated project CLAUDE.md with detailed commands, workflows, and guidelines - Added environment configuration and performance monitoring commands - Enhanced security guidelines and commit message conventions - Created 5 custom slash commands for common MEV bot development tasks: * /analyze-performance - Comprehensive performance analysis * /debug-issue - Structured debugging workflow * /implement-feature - Feature implementation framework * /security-audit - Security audit checklist * /optimize-performance - Performance optimization strategy - Updated global CLAUDE.md with universal best practices - Improved file organization and development standards 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2.1 KiB
2.1 KiB
Optimize MEV Bot Performance
Optimize the performance of the MEV bot in the following area: $ARGUMENTS
Performance Optimization Strategy:
1. Profiling and Measurement
# CPU profiling
go tool pprof http://localhost:9090/debug/pprof/profile?seconds=30
# Memory profiling
go tool pprof http://localhost:9090/debug/pprof/heap
# Trace analysis
go tool trace trace.out
# Benchmark testing
go test -bench=. -benchmem ./...
2. Optimization Areas
Concurrency Optimization
- Worker pool sizing and configuration
- Channel buffer optimization
- Goroutine pooling and reuse
- Lock contention reduction
- Context cancellation patterns
Memory Optimization
- Object pooling for frequent allocations
- Buffer reuse patterns
- Garbage collection tuning
- Memory leak prevention
- Slice and map pre-allocation
I/O Optimization
- Connection pooling for RPC calls
- Request batching and pipelining
- Caching frequently accessed data
- Asynchronous processing patterns
- Rate limiting optimization
Algorithm Optimization
- Uniswap math calculation efficiency
- Event parsing performance
- Data structure selection
- Caching strategies
- Indexing improvements
3. MEV Bot Specific Optimizations
Transaction Processing Pipeline
- Parallel transaction processing
- Event filtering optimization
- Batch processing strategies
- Pipeline stage optimization
Market Analysis
- Price calculation caching
- Pool data caching
- Historical data indexing
- Real-time processing optimization
Arbitrage Detection
- Opportunity scanning efficiency
- Profit calculation optimization
- Market impact analysis speed
- Cross-DEX comparison performance
Implementation Guidelines:
- Measure before optimizing (baseline metrics)
- Focus on bottlenecks identified through profiling
- Maintain code readability and maintainability
- Add performance tests for regressions
- Document performance characteristics
Deliverables:
- Performance benchmark results (before/after)
- Optimized code with maintained functionality
- Performance monitoring enhancements
- Optimization documentation
- Regression test suite