-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat(debug): conditionally implement debug for test errors #166
Conversation
Currently, all error types in the project have a default debug implementation necessary only for testing purposes. This unnecessary code in release builds increases the WASM binary size. This commit optimizes the code by implementing #[derive(Debug)] only for tests.
✅ Deploy Preview for contracts-stylus canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
Hey @kaustubh1106, this looks perfect! Thanks for the contribution. I see that the binary sizes remain the same after these changes, so I need to do some sanity checks to confirm my assumptions. It may be possible that I was wrong and we are actually not including I'll report back after I get some time, sorry about this. |
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.
Thanks @kaustubh1106 for your contribution. The changes you proposed looks okay, looking forward to @alexfertel research.
Hey @kaustubh1106 , I'm really sorry, it turns out that our Debug implementations do not get included in the compiled binary. The Rust compiler does an impressive job. You can check yourself by doing this:
For the
which doesn't include our Debug implementations, and even if it did, the impact is completely dominated by other stuff. cc: @bidzyyys @qalisander I will close this PR and its corresponding issue since this work is no longer justified. I hope this doesn't deter you from contributing to our library in the future. Thank you very much. |
Currently, all error types in the project have a default debug implementation necessary only for testing purposes. This unnecessary code in release builds increases the WASM binary size. This commit optimizes the code by implementing
#[derive(Debug)]
only for tests.
Resolves #165
PR Checklist