Slow loop - gets faster after first run

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

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

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.