Any Validity In Destroy being slow?

I was working with a gui recently and found that destroy() seems to be slow with lots of children (in my case over 100). So much so that doing

for i,v in pairs(gui:GetChildren()) do 
      spawn(function()
          v:Destroy()
     end)
end
gui:Destroy()

was actually faster to destroy the object. Am I going crazy or is this a real thing?

Coincidentally I was thinking the exact same thing, the number of image labels in my case would increase exponentially and either it seemed as or it was that :Destroy() was behind.

But for your case you should be fine, because I don’t believe :Destroy yields, if anything use coroutine instead of spawn().

How is destroying an object slow? Can you provide benchmark results?

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