Skip to content
CCPEDIAby Unity Nodes
App Development

Is there a limit on a collection inside a template?

4 posts200 views3 likesLast activity Jan 2024

  1. cohen.avrahamOP 1

    G-d willing

    Hello,
    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?

    Thanks,

  2. Luciano
    cohen.avraham:

    And what about updating the contract with 100K elements, how heavy-lifting will it be?

    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).

  3. cohen.avraham

    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

  4. ali-abrar 2

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