reth
reth copied to clipboard
Tune performance of fetch pending hashes
trafficstars
Describe the feature
This issue builds on Profile tx fetching to improve transaction fetching performance.
Optimizations Applied
- Removed nested call stacks in hash computations
- Eliminated function passing through multiple levels
- Converted deferred/batch cleanups to eager processing
- Added strategic early returns
- Inlining
- Streamlined LRU cache access patterns
These changes resulted in ~51% performance improvement in transaction fetching operations.
Additional Consideration: LRU Usage
Currently, some fields like seen_hashes are using an LRU cache, but this might not be optimal.
Why LRU might not be ideal:
- Do we actually need ordering? Seems like main purpose is deduplication?
- LRU operations have overhead from maintaining order
- Cache eviction order might not align with transaction processing patterns
Would love feedback on whether ordering is actually important, as moving to a simpler data structure could yield sweet performance juice.