ElseIf Statements to Import Snippets (Slow Down)

Hello Text Blaze Community!

I have been struggling to solve this issue for quite some time and I'm wondering if there is any worth-while work-around out there.

Issue: Within a repeater, I have a snippet (SnipA) which is used to import various sub-snippets based on a Drop-down menu (MenuA). SnipA has > 100 sub-snippets called-on to be imported through else-if statements. These sub-snippets are not complex, but some do contain drop-downs, toggles, and an if-statement or two here and there.

  • The more elseIf statements referring to other sub-snippets I add to SnipA, the slower my overall process.
    -- With the repeater at >3, the entire process becomes unusable with delays >6 seconds generated while typing in text/paragraph boxes.

  • What I've tried...
    -- Keyed lists: some sub-snippets do not allow for this given their if-statements and toggles. Overall this is a laborious process that does not streamline expansion.
    -- Excluding SnipA from the repeater: referencing local repeater values did not yield the desired format.
    -- Locating other sources of slow down: eliminating more and more elseIf statements clearly speeds up the process.

A dynamic import function would seemingly streamline my desired process but I can't say for sure.

My many snippets are quite intertwined and do not allow for easy visualization without some explanation but if there are any ideas out there I would gladly try sharing.

Thank you in advance, I appreciate any guidance :slight_smile:

Hello again @Andrei_Aldea1 !

Note that all imported snippets contribute to the overall "size" of your snippet even if they are not visually visible in the form window. I suppose a couple of your imported sub-snippets are larger than the others, and they are causing this slowdown. It might be best to separate those sub-snippets from the rest into a separate parent snippet.

As a quick test, you can keep your chain of 100 else-ifs, but instead just import the same one snippet in all of them. Then start changing them one-by-one with different snippets, until you see the issue starts appearing.

Note that - in general - larger snippets will take longer time to process compared to smaller snippets. If you are able to reproduce this lag with smaller snippets, please let us know and we'll be happy to troubleshoot it further.


Hi @Gaurang_Tandon :slight_smile: Good to speak to you again!

I performed the tests you suggested:

  • Imported the same snippet (simple level complexity) > 100x into the ElseIf chain: Slow-down improved
  • Changed snippets one-by-one: the slow-down gradually increased
    -- Yes, certain sub-snippets are more problematic than others, but seemingly not by a significant enough margin where excluding/altering a small amount of sub-snippets will mitigate my issue.
    -- Adding sub-snippets one-by-one into the Else-If chain also yielded a gradual, seemingly linear slow-down.

My understanding is that although some sub-snippets are more problematic than others, it's the sum of many sub-snippets that cause my slow-down which is very evident in a repeater. Does this make sense?

That being said, I'm unsure how to proceed.

Thanks again for your help and any further guidance :slight_smile:

Thanks for confirming. Overall, we expect larger snippets to be slower to process. If you are able to reproduce this lag with smaller snippets, please let us know and we will definitely check it further.