Motoko vs. Rust: Trade-offs now and into the future

I’d love @rossberg insight here , but I think you ashould take his 2-3x comment in light of one of his other comment

Rust writes its data to stable structures which will be much more expensive to use than motoko’s new enhanced orthogonal persistence. In addition your upgrades are going to be much more efficient in motoko with eop. Rust will require you to read from and then require to stable memory causing you to repeat that cost. EOP may have some processing cost upon upgrade, and maybe that is going to be 2-3x what your processing cost would be in rust, but likely far less in cycles over all due to stable memory costs.

Someone closer to the compilers and actual memory costs can enlighten this discussion with hard data. I did a bit of searching for benchmarks for system calls, specifically stable memory, reading, right, but couldn’t find much.

A bunch also has to do with what you used to serialize and some people have found some optimization using different libraries, but with Motoko he just put the thing in memory so you’re using base instructions with no serialization or deserialization.

Some info about how stable memory works:

Basically, motoko doesn’t have to deal with all that crap now.

7 Likes