Is there a limit on a collection inside a template?

G-d willing

Is there a limit on the size of a collection I can use inside a template?
Saying a collection of 100K elements… is that possible?
And what about updating the contract with 100K elements, how heavy-lifting will it be?


1 Like

One thing I know is that there is no structural sharing on the ledger. So if I have a 100k element list on a contract, and I prepend one element to it, it will re-write all 101k values (unlike that same operation in memory).

G-d willing

Thanks @Luciano for your reply.
I am aware to the consequences of adding another element to the collection.
But, can I assume that when it reaches 200K elements, the application won’t be able to handle it due to memory limit? Generally, I would like to know when this approach is about to fail

You might eventually hit transaction size limits, depending on how large each of these elements is. See Transaction size threshold?