A question about coroutines

Hello everyone,

I’m making a while task.wait(1) do loop and use coroutines inside it. the loops never stop until the round finish (around 45 mins or more) and I’m a bit worried about performance as I will wrap around 3-4 coroutines per loop. Are coroutines performance friendly or should I look at other ways?

So every second, a new coroutine is created, and they all take 45 minutes to stop? If so, that’s about 2700 different threads running at once. If you’re making 3-4, it would be 10k+ threads running at once. Is this true?

Thanks for the replay,

actually the 45 minutes is for the main thread and not for the coroutines

the functions are somewhat light but I should know whether it is bad for performance to repeat like 3 of them every second

If there’s only ever 3 running at once from that loop, it should be fine.

1 Like

well let’s say I increased it how much could I go before I notice any performance issues?

Maybe over 50 would start to be noticable. Even if it wasn’t lagging, there would be room to improve that system so there isn’t as many threads.

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