# Delays when using function blocks in loops

**URL:** <https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478>\
**Category:** Questions about Thunkable X\
**Created:** [July 11, 2020, 8:15am UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478 "2020-07-11T08:15:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddie.rebehy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eddie.rebehy/32/67993_2.png) [@eddie.rebehy](https://community.thunkable.com/u/eddie.rebehy)\
**Post date:** [July 11, 2020, 8:15am UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/1 "2020-07-11T08:15:45Z")

</div>

Hi Thunkers,

I have noticed in several places of my app that some execution times where not making any sense. I managed to trace the issue down to the use of functions. I have made a very simple app to test my findings.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/2/7223f7b27eed88019b45c36008c909ec65af5ea4.png)

 ![Screenshot_20200711-175526_Thunkable](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/8/18d7b8e991c717d625c66ed17f5db467d249185e.jpeg)

I have downloaded this directly to my Android to rule out interface delays. Calling functions seem to be taking unreasonable times. I have tried this with several different arbitrary tasks with similar results.

Also the overhead on this simple app is 36Mb. Is that normal?

[https://x.thunkable.com/projectPage/5f096a5c05e9080abe26788b](https://x.thunkable.com/projectPage/5f096a5c05e9080abe26788b)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 12, 2020, 1:50pm UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/2 "2020-07-12T13:50:09Z")

</div>

You’re right. More information about performance on [http://droidscript.ru/main/statyi/thunkablex\_base11.php](http://droidscript.ru/main/statyi/thunkablex_base11.php)

The large file size of empty applications is a feature of Thunkable X. The file size for IOS ipa is even larger (times 2)

---

<div class="post-metadata">

**Author:** ![eddie.rebehy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eddie.rebehy/32/67993_2.png) [@eddie.rebehy](https://community.thunkable.com/u/eddie.rebehy)\
**Post date:** [July 13, 2020, 12:23am UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/3 "2020-07-13T00:23:12Z")

</div>

Thanks for the link @actech . These tests are exactly what I was looking for.

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 14, 2020, 9:46am UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/4 "2020-07-14T09:46:14Z")

</div>

Hey @eddie.rebehy and @actech - we’re working on some (unrelated) updates to the function blocks which are in review at the moment and they will hopefully be out later this week or early next week.

Once that update is out we can start looking a bit closer at what’s going on here and start planning the next update. Just to be up front about this though, this is not something we’re going to be spending a significant amount of time on in the coming weeks.

@eddie.rebehy if you have a loop like this where you need to do something 1,000 times, our advice for the time being is to just place the blocks in-line, rather than creating functions for everything. This will allow you to get the fastest possible version of your app to your users, and in a future update you can then optimised the blocks.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![eddie.rebehy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eddie.rebehy/32/67993_2.png) [@eddie.rebehy](https://community.thunkable.com/u/eddie.rebehy)\
**Post date:** [July 14, 2020, 11:35am UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/5 "2020-07-14T11:35:53Z")

</div>

thanks @domhnallohanlon.

I understand and will continue to work around this for time sensitive tasks.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [December 21, 2019, 5:18pm UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/6 "2019-12-21T17:18:06Z")

</div>

Recently, a forever block has appeared in blocks. Why is this loop needed if it runs 246 times slower than the slowest for each loop?

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/8/68cf889a5c11fb8f92e220afcfd4a8c3eb08a565.png)

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/d/9d76df4095c7a482b9990be578d07e79faa5a7ff.png)

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:46am UTC](https://community.thunkable.com/t/delays-when-using-function-blocks-in-loops/671478/7 "2024-11-08T11:46:19Z")

</div>


