New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Memory Pool for Randao Mixes #4896
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for general audiences, can you touch base on why we switch to memory pool? the decision factors.. etc
name = "go_default_library", | ||
srcs = ["memorypool.go"], | ||
importpath = "github.com/prysmaticlabs/prysm/shared/memorypool", | ||
visibility = ["//visibility:public"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anything wrong with it ? it makes sense to make this public as it is in shared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry, thought it was in beacon-chain
Co-Authored-By: terence tsao <terence@prysmaticlabs.com>
Codecov Report
@@ Coverage Diff @@
## master #4896 +/- ##
==========================================
+ Coverage 46.18% 47.75% +1.56%
==========================================
Files 207 206 -1
Lines 16578 15338 -1240
==========================================
- Hits 7657 7324 -333
+ Misses 7765 6870 -895
+ Partials 1156 1144 -12 |
Co-Authored-By: terence tsao <terence@prysmaticlabs.com>
* add mem pool * use mem pool * Update shared/memorypool/memorypool.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update shared/memorypool/memorypool.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
* add mem pool * use mem pool * Update shared/memorypool/memorypool.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update shared/memorypool/memorypool.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
This was originally from #4844 but has been separated into its own PR
The shift to using a memory pool here is so that we can re-use non-referenced objects on the heap which havent been cleared by the GC. This allows us to avoid allocating new memory again and instead we can just re-use it. Since Randao Mixes is one of our most expensive fields when modifying the state, it would be most useful to re-use already destroyed objects instead of allocating a new array.