Clarification on Stable Types with Examples

Yes, that’s a perfectly viable solution. The other is to use a regular HashMap in a regular variable and save/restore it via a stable variable in pre/postupgrade hooks, but that is more expensive during an upgrade.

There is no hidden cost to your approach. Under the hood, the parameter is just a pointer into the heap.

5 Likes