# The problem of using the \[number of rows in\] block in a loop

**URL:** <https://community.thunkable.com/t/the-problem-of-using-the-number-of-rows-in-block-in-a-loop/842007>\
**Category:** Questions about Thunkable X\
**Created:** [September 23, 2020, 9:34am UTC](https://community.thunkable.com/t/the-problem-of-using-the-number-of-rows-in-block-in-a-loop/842007 "2020-09-23T09:34:23Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [September 23, 2020, 9:34am UTC](https://community.thunkable.com/t/the-problem-of-using-the-number-of-rows-in-block-in-a-loop/842007/1 "2020-09-23T09:34:23Z")

</div>

My research shows that using the [number of rows in] block in a loop block is much slower when it is not in the loop block.

I think the problem is that, firstly, this block is calculated very slowly and, secondly, it is calculated at each iteration of the loop, which looks quite strange to me personally.

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

Yes, I was not mistaken. 100 iterations for the [length of] block run on Android for 0.001 seconds, and for the [number of rows in] block when using Local DB - for 0.49 seconds (500 times slower)!

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [September 23, 2020, 9:43am UTC](https://community.thunkable.com/t/the-problem-of-using-the-number-of-rows-in-block-in-a-loop/842007/2 "2020-09-23T09:43:16Z")

</div>

Thanks, this is a valuable hint! Maybe the “number of rows” gets recalculated, because when there a items deleted or inserted inside of the loop the number of elements changes?

---

<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:** [September 23, 2020, 9:44am UTC](https://community.thunkable.com/t/the-problem-of-using-the-number-of-rows-in-block-in-a-loop/842007/3 "2020-09-23T09:44:14Z")

</div>

No, there is no data change in the loop. The blocks for evaluating performance are shown below

 ![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/d/2d25b134082790b22105503b56c6fd6b2b4e8ca4.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, 12:23pm UTC](https://community.thunkable.com/t/the-problem-of-using-the-number-of-rows-in-block-in-a-loop/842007/4 "2024-11-08T12:23:49Z")

</div>


