Skip to content
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

Merged
merged 4 commits into from Feb 18, 2020
Merged

Use Memory Pool for Randao Mixes #4896

merged 4 commits into from Feb 18, 2020

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Feb 17, 2020

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.

Copy link
Member

@terencechain terencechain left a 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"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visibility

Copy link
Member Author

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

Copy link
Member

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

shared/memorypool/memorypool.go Outdated Show resolved Hide resolved
shared/memorypool/memorypool.go Outdated Show resolved Hide resolved
Co-Authored-By: terence tsao <terence@prysmaticlabs.com>
@codecov
Copy link

codecov bot commented Feb 17, 2020

Codecov Report

Merging #4896 into master will increase coverage by 1.56%.
The diff coverage is 92.85%.

@@            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>
@nisdas nisdas mentioned this pull request Feb 18, 2020
5 tasks
@nisdas nisdas merged commit 3d12322 into master Feb 18, 2020
@delete-merged-branch delete-merged-branch bot deleted the memPool branch February 18, 2020 00:25
cryptomental pushed a commit to cryptomental/prysm that referenced this pull request Feb 24, 2020
* 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>
cryptomental pushed a commit to cryptomental/prysm that referenced this pull request Feb 28, 2020
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants