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>
1.5 KiB
1.5 KiB
Reduce Memory Allocations
Reduce memory allocations in the following hot path: $ARGUMENTS
Memory Optimization Strategy:
1. Allocation Analysis
- Identify high-frequency allocation points
- Measure current allocation rates and patterns
- Analyze garbage collection pressure
2. Optimization Techniques
Object Pooling
- Implement sync.Pool for frequently created objects
- Pool buffers, structs, and temporary objects
- Proper reset patterns for pooled objects
Pre-allocation
- Pre-allocate slices and maps when size is predictable
- Reuse existing data structures
- Avoid repeated allocations in loops
Buffer Reuse
- Reuse byte buffers and string builders
- Implement buffer pools for I/O operations
- Minimize string concatenation
3. MEV Bot Specific Optimizations
Transaction Processing
- Pool transaction objects and event structures
- Reuse parsing buffers
- Optimize log and metric object creation
Mathematical Calculations
- Pool uint256 and big.Int objects
- Reuse temporary calculation buffers
- Optimize precision object handling
Implementation Guidelines:
- Measure allocation reduction with benchmarks
- Monitor garbage collection statistics
- Ensure thread safety in pooled objects
- Maintain code readability and maintainability
Deliverables:
- Memory allocation reduction benchmarks
- Optimized code with pooling strategies
- GC pressure analysis before and after
- Memory usage monitoring enhancements
- Best practices documentation for team