You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of our grant, we want to help to reduce the size of contracts. We analyzed the binary(web assembler) file and found that ink! generates many the same code in the case of scale::Decode and scale::Encode.
So, we decided to create the ink_codec library which allows us to use it in a dynamic dispatch manner.
Example of traits:
pubtraitEncodable{/// Convert self to an owned vector.fnencode(&self) -> Vec<u8>{letmut dest = Vec::new();self.encode_to(&mut dest);
dest
}/// Convert self to a slice and append it to the destination.fnencode_to(&self,dest:&mutdynOutput);}pubtraitDecodable{/// Attempt to deserialize the value from input./// /// # Note/// The object must exist before calling the `decode`.fndecode(&mutself,input:&mutdynInput) -> Result<(),Error>;}
We've already started working on this change(it is based on the code of release 3.0-rc5). This issue is needed to avoid duplication of work(as it was with #945) and track the progress. After the implementation of the change, we will provide a report about the size of ERC-20(and maybe other heavy contracts from the example folder) and the source code. If the result is good and you agree with our idea, we will open a pull request.
The text was updated successfully, but these errors were encountered:
Note that dynamic dispatch prevents tons of optimizations that the compiler usually can perform with static dispatch and inlined functions. So inlining usually is not only evil with respect to Wasm file sizes but might even be superior to what you save through dynamic dispatch and non-inlining.
Still, I am looking forward to your research results.
As part of our grant, we want to help to reduce the size of contracts. We analyzed the binary(web assembler) file and found that ink! generates many the same code in the case of
scale::Decode
andscale::Encode
.So, we decided to create the
ink_codec
library which allows us to use it in a dynamic dispatch manner.Example of traits:
We've already started working on this change(it is based on the code of release 3.0-rc5). This issue is needed to avoid duplication of work(as it was with #945) and track the progress. After the implementation of the change, we will provide a report about the size of ERC-20(and maybe other heavy contracts from the
example
folder) and the source code. If the result is good and you agree with our idea, we will open a pull request.The text was updated successfully, but these errors were encountered: