Sorry if it’s a basic question. I’m looping through 20 ‘profiles’ per second and they’re performing some heavyish calculations and for some reason when I don’t use task.spawn or task.defer, it seems to have false positives/break.
Anyways, is there a difference between the two in perfomance?
Every function Roblox provides is well-optimized, so even though there might be a slight performance difference between the two functions, it won’t be noticeable.
The only different between them is that task.spawn() calls the function immediately through the scheduler, and task.def() calls it after the next resumption cycle.
I feel like task.defer would be a better practice in terms of having a stable decent FPS; provides wider support on more devices, but I doubt there would be much noticeable difference. task.spawn makes your scripting experience more predictable