-
Notifications
You must be signed in to change notification settings - Fork 704
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
Improve debuggability in wasm #3005
Comments
I can do this... |
Doing just this for this experiment would probably much easier :) Of course if we decide to merge we probably want to replace the deprecated
Would be appreciated. Remember to build with We also have to keep in mind that there are a bunch of "manual" polkadot-sdk/substrate/primitives/arithmetic/src/fixed_point.rs Lines 902 to 923 in a78ff7d
In addition to float it also uses |
If you have read my steps, I have said exactly this :P |
Okay then I said nothing 🤝 |
I did some initial tests. I scripted some Then I compiled with these changes and compared the wasm binary sizes:
So it seems there's nearly no difference in size. |
Did you compile with |
Those are probably the uncompressed artifacts. Can you also add the |
Here are the results for the compressed runtimes. I'll double-check it on monday.
|
Yes our limits are on the compressed file size! Looks good :) |
But zero size gain is unexpected, isn't it? Since those debug implementations are actually used to print log lines I would expect the binary to get bigger. Or am I missing something? |
I must recalculate the gains with byte-precision to get the exact numbers. I used 0.1KB precision for the above calculation so maybe it's <100bytes or I made an error. |
Here are the numbers in bytes:
|
Just from a gut feeling it seems too good. I could be wrong but I think we need to make sure that no mistake happened. Can you:
Then we can reasonably sure that no error happened. |
I mean the main difference should be extra string being added to the runtimes. We also don't log everything etc. So, maybe not that wrong what we see there. |
Maybe. But it is not only strings. Also the code that does the formatting at runtime. True, the
That seems to be the most plausible explanation to me. |
@bkchr Sorry Bastian, I think I'll not have the time in the near future that this Issue requires. Feel free to reassign it. |
Over the years we have tried to prevent any kind of leakage of the
Debug
trait into wasm to decrease the size of the wasm binary. However, AFAIK we never really looked into the impact of havingDebug
implemented for types. Especially as the linker should remove unusedDebug
implementation any way. We even have introducedRuntimeDebug
that just printswasm:stripped
onno_std
. The problem with all this is that it complicates debugging in wasm. In the future when there will be no native runtime, it is even more important. So, we should look into derivingDebug
everywhere instead ofRuntimeDebug
. We should also changeRuntimeDebug
to always derive the defaultDebug
to not break any downstream code, but still have proper debug output.So, for this issue:
RuntimeDebug
to always derive defaultDebug
.RuntimeDebug
everywhere in the code base.The text was updated successfully, but these errors were encountered: