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

Optimize AssetVault serialization to avoid vector allocation #1189

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

This commit optimizes the serialization of AssetVault by eliminating unnecessary vector allocation.

Previously, the write_into method was collecting all assets into a temporary vector before writing them to the target, which was inefficient for large asset collections. The new implementation counts the assets directly using the iterator's count() method and then iterates through the assets again to write them one by one.

This change improves memory efficiency by avoiding the allocation of a temporary vector, which is especially beneficial for vaults with many assets.

Resolves TODO: "determine total number of assets in the vault without allocating the vector"

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.

1 participant