Seperate threads for objects or loop through all

Say i have 10 models in my game which i want to spin around infinitely at a fixed rate by using cframe manipulation.

Do i loop through every object and then rotate it or do i create a thread for each one (making a new script for each one, or using task.spawn or coroutines) to rotate each one in seperate threads?

Which one is more performant?

1 Like

Separating the rotation process into separate threads is no more effective at creating a uniform rotation effect. This is because threads do not run concurrently. They run only when all other threads are suspended. You would just be moving onto the next model after the previous one was rotated, which is no different from using a loop. For this reason, spare the task scheduler and memory resources from redundant threads.

Regardless, if you have an ungodly number of models to rotate, the time spent rotating those models is time spent keeping all other threads suspended. This can cause momentary freezing. You may want to consider parallel Luau

2 Likes

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