Skip to content

Comments

perf(vm): avoid zeroed allocation in BasicMemory::clone#2352

Merged
jonathanpwang merged 1 commit intoopenvm-org:mainfrom
MozirDmitriy:perf/basic-memory-clone-alloc
Jan 31, 2026
Merged

perf(vm): avoid zeroed allocation in BasicMemory::clone#2352
jonathanpwang merged 1 commit intoopenvm-org:mainfrom
MozirDmitriy:perf/basic-memory-clone-alloc

Conversation

@MozirDmitriy
Copy link
Contributor

Replace alloc_zeroed with alloc in BasicMemory::clone to avoid unnecessary zero-initialization before copying the existing contents. The clone path always overwrites the entire allocated region with copy_nonoverlapping, so zeroing first provides no safety benefit but doubles the amount of memory work for large buffers. The constructor still uses alloc_zeroed to preserve the invariant that freshly created linear memory starts zeroed.

@jonathanpwang jonathanpwang merged commit 9eef85b into openvm-org:main Jan 31, 2026
69 of 70 checks passed
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