How to see how long a for i loop will run or run it for a set time

I want to either know how long the for i loop will take, or be able to control how long it takes. But it’s hard to predict something like that, and I need to be able to do it consistently no matter the input.

My guess is that it takes a linear amount of time.

here’s a block for measuring scripts’ durations in seconds:

untitled script pic (64)

Thanks!