Direct Integration with Bitcoin

I wonder, if we had 64-bit Wasm heap some time in the future, would developers still want to operate on stable data structures or just keep everything in the heap and move in and out of stable memory in the pre- and post-upgrade hooks (i.e., use stable memory just for upgrades)?

I think it would really depend on the cycle costs of one versus the other. Personally, I like operating directly on stable data structures and keeping the canister upgrade process as simple as possible, but if it costs me 2x as many cycles I’d probably be less enthusiastic.

Do you have an opinion on this? Just thinking whether it would make sense to further pursue work on stable structures particularly also for Motoko, e.g., as part of the grants program.

Yes! I know that I sorely need stable data structures, and I’m sure other developers need them too.

And I’m referring to a different kind of stable data structure than the kind @icme is working on. IIUC @icme is porting object-oriented data structures (like Motoko’s HashMap) to a functional form that can be stored in a Motoko stable variable using the stable keyword.

That is different from the stable data structure that @dieter.sommer and his team are building, which directly stores data in stable memory without any serialization/deserialization (which is implicitly done when using stable variables).

Just thinking whether it would make sense to start a forum topic on stable data structures to advertise to the community what we have and get further requirements and participation. What do you think?

I think this is a great idea. I suspect quite a few in the community will have thoughts on this. In some sense, this is an interesting alternative to BigMap: instead of scaling out using canisters, we can scale up using stable memory.

Relying on ExperimentalStableMemory in Motoko isn’t ideal, as @claudio explains here.

In fact, another benefit of these types of stable data structures is that they can abstract over ExperimentalStableMemory, so that if we one day want to replace that library with a more fine-grained library that provides better memory isolation we can do so without breaking stable data structure users.

1 Like