Best Practices for Optimizing Canister Performance on the Internet Computer

Hello and welcome!

There are a lot big-brained people on here who will no doubt steer you in the right direction. Some quick points from my experience

  1. Working in runtime memory (not stable) is the cheapest and quickest way to store data. It is however limited to (IIRC) 4gb at the moment. It’s also super easy in Rust with standard structures working out of the box.

  2. There are two main stable memory Rust crates you can use on the IC

  • IC Stable Structures - This was created by Dfinity and I believe is the most widely used. It is however not as performant in terms of instructions as;
  • IC Stable Memory - This was crated by a big-brain member of the community. I’m not sure if it’s still being maintained but is what I generally use. It’s maybe not quite as easy to use though.

Having said all that - I recently hit a problem with one of my canisters (post here) due to memory limits. It could be worth keeping an eye on that post to see what the giga-brains say about it.

Cheers!

2 Likes