Description
Is your feature request related to a problem? Please describe.
As a user, I want to make sure I'm using the correct programming language to write my smart contracts. I am unaware of the implications on storage or gas and would like to see a page detailing this.
Describe the solution you'd like
A page or section in the docs that goes over gas and storage implications of using AssemblyScript vs Rust.
Additional context
Good thoughts here from Max:
Is there anything where AS stands up more than Rust (or vice versa)?
- I doubt AssemblyScript contracts are cheaper than Rust contracts in terms of gas used. Most of the gas cost comes from the host functions that are not specific to the language. Also, Rust contracts leverage binary serialization more than AssemblyScript that uses JSON for everything. JSON is significantly more expensive than binary serialization.
- In terms of the contract size current AssemblyScript contracts that we used for examples tend to be 20% smaller than similar Rust contracts, but it does not mean we cannot write smaller contracts in Rust. In fact, we have some contracts in Rust that are 400 bytes large. It is just that we haven't added no-std option to near-sdk-rs, so that people who want their contracts smaller need to do it manually. Also, please keep in mind that 20% size is a small difference compared to the overall contract size variance that can be anything between 100KiB and 200KiB for a typical contract if you don't put optimization efforts into it. I don't really think it makes sense to worry about the contract size unless it is >>300KiB.
- Yes, AS is lagging behind in terms of functionality added. Partially because AS is a new language and we need to contribute some changes to the language itself to bring it on par with Rust. FYI Near is the largest financial sponsor of AS and we also co-organize AS community group.
- AssemblyScript (not recommended for financial applications)
- AssemblyScript is a new language that has a much smaller community than Rust. While we are contributing a lot towards its maturity and participate in its development, we need to see more signs of its maturity before we can vouch for it as a completely safe language for financial applications, e.g. having a stable version
There are many Web2 projects that could benefit from migrating or integrating with us. Many of these web-projects are built by the developers who are used to JS/TS-like ecosystem. AssemblyScript is our attempt to make the transition for the people coming from the Web2 world as easy as possible. Currently, anyone who is familiar with TypeScript can build an end-to-end application on us.
Overall, we want to have contract languages that provide a good coverage of all ecosystems:
- Rust -- for delicate financial code;
- AS -- for web-developers;
And something we are currently brainstorming: - Kotlin -- for mobile-developers, plus maybe backend developers not covered by Rust
from:
https://discordapp.com/channels/490367152054992913/510254340120903684/714528239040856114