Files
mev-beta/orig/.claude/commands/optimize-performance.md
Administrator c54c569f30 refactor: move all remaining files to orig/ directory
Completed clean root directory structure:
- Root now contains only: .git, .env, docs/, orig/
- Moved all remaining files and directories to orig/:
  - Config files (.claude, .dockerignore, .drone.yml, etc.)
  - All .env variants (except active .env)
  - Git config (.gitconfig, .github, .gitignore, etc.)
  - Tool configs (.golangci.yml, .revive.toml, etc.)
  - Documentation (*.md files, @prompts)
  - Build files (Dockerfiles, Makefile, go.mod, go.sum)
  - Docker compose files
  - All source directories (scripts, tests, tools, etc.)
  - Runtime directories (logs, monitoring, reports)
  - Dependency files (node_modules, lib, cache)
  - Special files (--delete)

- Removed empty runtime directories (bin/, data/)

V2 structure is now clean:
- docs/planning/ - V2 planning documents
- orig/ - Complete V1 codebase preserved
- .env - Active environment config (not in git)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 10:53:05 +01:00

84 lines
2.1 KiB
Markdown

# Optimize Performance
Optimize the performance of the MEV bot in the following area: $ARGUMENTS
## Performance Optimization Strategy:
### 1. **Profiling and Measurement**
```bash
# 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