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

MerkleDB Improve Node Size Calculation #1950

Merged
merged 12 commits into from
Aug 31, 2023
Merged

MerkleDB Improve Node Size Calculation #1950

merged 12 commits into from
Aug 31, 2023

Conversation

dboehm-avalabs
Copy link
Contributor

The node that is being stored in the cache contains more than just its bytes, so make the size calculation more accurate by tracking its total size.

@danlaine
Copy link
Collaborator

I think it might suffice to just change cacheEntrySize to:

return len(p) + 2*len(n.marshal())

It won't be exactly right but it'll be pretty close and the diff is 2 characters, which is nice.

@dboehm-avalabs
Copy link
Contributor Author

I think it might suffice to just change cacheEntrySize to:

return len(p) + 2*len(n.marshal())

It won't be exactly right but it'll be pretty close and the diff is 2 characters, which is nice.

I'm cool with it if no one cares about it being 100% accurate.

Copy link
Collaborator

@danlaine danlaine left a comment

Choose a reason for hiding this comment

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

just nits

x/merkledb/db.go Show resolved Hide resolved
x/merkledb/intermediate_node_db.go Show resolved Hide resolved
x/merkledb/intermediate_node_db_test.go Outdated Show resolved Hide resolved
x/merkledb/intermediate_node_db_test.go Outdated Show resolved Hide resolved
x/merkledb/node.go Show resolved Hide resolved
@danlaine danlaine merged commit 2eabd22 into dev Aug 31, 2023
16 checks passed
@danlaine danlaine deleted the Cleanup branch August 31, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants