bee
bee copied to clipboard
refactor: sampling optimalizations
This PR optimizes the ReserveSample function to improve performance during sampling operations. The key optimizations include adding ChunkType to the SampleItem struct to avoid redundant parsing, reusing hashers in worker goroutines instead of creating new ones for each SOC chunk and using new optimized hasher function for transformed address calculations. These changes reduce memory allocations, GC pressure, and CPU usage without altering the functional behavior of the sampling process.
Checklist
- [ ] I have read the coding guide.
- [ ] My change requires a documentation update, and I have done it.
- [ ] I have added tests to cover my changes.
- [ ] I have filled out the description and linked the related issues.