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

Improve SplitMap deserialization. Make interning stricter #2675

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

lehins
Copy link
Collaborator

@lehins lehins commented Mar 2, 2022

Current deserialization for Map is a bit dumb: first it deserializes into a list, which is then reversed and only after that it is converted to a Map. It makes sense only for preservation of semantics of deserialization in presence of duplicate keys. For UTxO we know for sure there will never be any duplicate TxIns, which means that we can construct a Map as it is being deserialized thus avoiding intermediate list allocations, which saves memory and about 20% in deserialization time.

This PR also reduces memory overhead during deserialization by making internin a little stricter

@lehins lehins requested a review from TimSheard March 2, 2022 13:54
Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

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

LGTM!

@lehins lehins merged commit f3df540 into master Mar 2, 2022
@iohk-bors iohk-bors bot deleted the lehins/utxo-deserialization branch March 2, 2022 22:55
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.

2 participants