-
Notifications
You must be signed in to change notification settings - Fork 45
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
perf: possible mem leak in v8.serialize() #86
Comments
switch to https://developer.mozilla.org/en-US/docs/Web/API/structuredClone when it will be implemented by most of the browsers. |
👍🏻 Subscribing |
Maybe I'm not reading the bench correctly, but isn't lodash more performant than ungap here? |
You're reading the bench correctly ;-) lodash indeed is more performant than ungap and v8 in this case. Though I believe that for "bigger" states - v8 was the winner. Anyway, I'll stick with lodash for now... |
Just a word of comment if anyone was interested - deepCopy-ing of the state is required for each interaction - before the state is passed to the contract's handler function. Contracts usually modify the state directly and without deepCopy - there would be risk of changing values somewhere in the host code (eg. values stored in cache). v1 performed here simple stringify/parse https://github.com/ArweaveTeam/SmartWeave/blame/master/src/contract-step.ts#L56 - which obv. is least performant. This won't be an issue in case of WASM contract - which store their state in the wasm module memory. |
fixed in #108, released in |
Ah ok, I was confused with the commits being referenced using ungap, but they were probably old 🎉 Will try this |
Issue raised by Pianity.
In some environments the rss memory usage grows to very large values (it does not happen on my M1 though).
This is probably related to nodejs/node#40828
Removing the v8's serialization (https://github.com/redstone-finance/redstone-smartcontracts/pull/84/files#diff-5acab41990585fa68ae01ff7b2e2915628d19237840c3061b31fcadc1c0f09b8) fixed the memory leak issues, but at a cost of performance - therefore a better solution needs to be developed.
The text was updated successfully, but these errors were encountered: