# Slow loop - gets faster after first run

**URL:** <https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525>\
**Category:** Questions about Thunkable X\
**Created:** [April 18, 2025, 10:33pm UTC](https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525 "2025-04-18T22:33:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomjwise1](https://avatars.discourse-cdn.com/v4/letter/t/e495f1/32.png) [@tomjwise1](https://community.thunkable.com/u/tomjwise1)\
**Post date:** [April 18, 2025, 10:33pm UTC](https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525/1 "2025-04-18T22:33:57Z")

</div>

I am working on building a search function, and I have found the loop to be slow.  
I have simplified it to this:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/0/e06d2369603de364e8b4250c3fde683a5756538f.png)

On the browser, the first time this runs through the 40 rows/loops it takes around 40 seconds. All further runs take around 3 seconds.

When run in the Thunkable App, the first run is around the same -40 secs. The further runs, after a 2 second pause, run instantaneously.

Why would the first run take so much longer than the second, and further, runs?

Any thoughts would be appreciated.

Thanks  
Tom

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 19, 2025, 4:12am UTC](https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525/2 "2025-04-19T04:12:27Z")

</div>

I don’t know why the duration would be so different but there’s a more efficient way to find a text string in a data source column by using the `find first occurrence of` block and the `list of values` block. I explain it here: [Thunkable and returns a corresponding value from my sheet - #2 by tatiang](https://community.thunkable.com/t/thunkable-and-returns-a-corresponding-value-from-my-sheet/2446081/2).

---

<div class="post-metadata">

**Author:** ![tomjwise1](https://avatars.discourse-cdn.com/v4/letter/t/e495f1/32.png) [@tomjwise1](https://community.thunkable.com/u/tomjwise1)\
**Post date:** [April 21, 2025, 6:03pm UTC](https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525/3 "2025-04-21T18:03:36Z")

</div>

Thank you Tatiang.  
Can I use the _'find first ocurrence_’ to filter the rows of a table where the filtered value has duplicates? I can understand using it where there are only unique values.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 21, 2025, 10:09pm UTC](https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525/4 "2025-04-21T22:09:18Z")

</div>

> [@tomjwise1](#):
>
> Can I use the _'find first ocurrence_’ to filter the rows of a table where the filtered value has duplicates? I can understand using it where there are only unique values.

No, for that you need to use a loop. Another option is the _filterByFormula_ Airtable API command. But you’d have to be using Airtable for that.

Do you need more than one property (column) from each row? Or is “First\_Name” enough? If so, you could simplify by getting the list of values for that single column and then getting a list item for each row # using the loop. Because getting the row object in each iteration of the loop takes time.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [July 20, 2025, 10:09pm UTC](https://community.thunkable.com/t/slow-loop-gets-faster-after-first-run/3752525/5 "2025-07-20T22:09:56Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
