-
Notifications
You must be signed in to change notification settings - Fork 426
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
Don't grow memory on first allocation #1712
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions around Wasm instructions
Codecov Report
@@ Coverage Diff @@
## master #1712 +/- ##
==========================================
- Coverage 52.98% 52.97% -0.02%
==========================================
Files 212 212
Lines 6726 6728 +2
==========================================
Hits 3564 3564
- Misses 3162 3164 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Merged master and answered questions. Ready for another round. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did I get right that there is one available page by default, which is why this change will help?
Yes. But not necessarily one. Could be more. Depends on the program. |
Right now the allocator always grows the memory on the first allocation. This is because it isn't aware of how much heap is available on initialization.
Growing the memory is a very expensive operation. I can imagine that this is especially bad for calls which do little work but still allocate some memory. Not sure if we have such a performance profile in our waterfall. But I can imagine that this impacts getter functions.
This solution avoids this by first using the available heap. It is not perfect as it performs a bit more work per allocation. We could probably get rid of that with enough willpower and
unsafe
.