-
Notifications
You must be signed in to change notification settings - Fork 251
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
Implement no_std support for SDK #443
Comments
I suggest profiling the memory usage first to understand what exactly is causing bloat before jumping to the solutions. I would be surprised if std per se is a problem. My understanding is that, code-size wise, you don't pay for what you don't use in Rust/wasm. At the same time, some The relevant tools are: |
Just so that the link is not lost in private communication: this post shows that removing formatting machinery from an already no_std crates leads to 92% reduction in size: https://jamesmunns.com/blog/fmt-unreasonably-expensive/. |
I have profilled before and there are three major sources of bloat in wasm
files:
- fmt
- full path and error strings in asserts and other errors
- std dependencies of some libraries like serde and rand
For example I have 8kb contracts for NEAR without using SDK right now when
reducing it when avoid using dependencies and asserts.
…On Tue, Jun 22, 2021 at 2:39 AM Aleksey Kladov ***@***.***> wrote:
Just so that the link is not lost in private communication: this post
shows that removing formatting machinery from *an already no_std* crates
leads to 92% reduction in size:
https://jamesmunns.com/blog/fmt-unreasonably-expensive/.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABK27WWNI5BTPLJPY6FN6TTUBK5TANCNFSM462C3ZGQ>
.
--
Best regards,
Illia Polosukhin
|
It would be rad if we can get the size of rust contracts down to 8kb |
Checked - adding core::alloc::format and formatting a simple literal -
+4kb, debug formatting vector - +10kb to binary size. In general any debug
formatting especially on the structs will always balloon the size of the
binary, so derive(Debug) should be excluded for wasm.
…On Fri, Jun 25, 2021 at 5:46 AM Bowen Wang ***@***.***> wrote:
It would be rad if we can get the size of rust contracts down to 8kb
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABK27Q5MKMCETWUZOXABCLTUR3CZANCNFSM462C3ZGQ>
.
--
Best regards,
Illia Polosukhin
|
Just for context, I want to mention that there is an experimental no-std NEAR SDK: https://github.com/austinabell/nesdie |
The goal is to reduce dramatically contract size.
For example contract without
std
can be 5-8KBCurrently this requires to not use SDK at all.
The text was updated successfully, but these errors were encountered: