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>
68 lines
1.8 KiB
Markdown
68 lines
1.8 KiB
Markdown
# Optimize Performance
|
|
|
|
Optimize the performance of the following component in the MEV bot: $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
|
|
|
|
# Goroutine analysis
|
|
go tool pprof http://localhost:9090/debug/pprof/goroutine
|
|
|
|
# Mutex contention analysis
|
|
go tool pprof http://localhost:9090/debug/pprof/mutex
|
|
```
|
|
|
|
### 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
|
|
|
|
#### **Algorithm Optimization**
|
|
- Computational complexity reduction
|
|
- Data structure selection
|
|
- Caching strategies
|
|
- Lookup table implementation
|
|
|
|
### 3. **MEV Bot Specific Optimizations**
|
|
|
|
#### **Transaction Processing**
|
|
- Parallel transaction processing
|
|
- Event filtering optimization
|
|
- Batch processing strategies
|
|
|
|
#### **Market Analysis**
|
|
- Price calculation caching
|
|
- Pool data caching
|
|
- Historical data indexing
|
|
|
|
## 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 |