Is destroying parts slower than updating them?

Suppose, I want to synchronize state of one part with another. Should I update all required properties or just re-create the part?

6 Likes

Either way should work unless you want to maximize performance.

5 Likes

Yes, I need good performance.
char limit

6 Likes

Updating them probably saves memory.

7 Likes

Are there any benchmarks that prove it?

5 Likes

Idk, but It just makes sense that updating it is more memory efficient because it can take the garbage collector a while to clear destroyed parts, while updating it doesn’t even need to destroy and recreate parts.

5 Likes

Technically, you will have to do more actions when you destroy. While updating, you will only update the specific stuff. When you destroy, you have to recreate it, doing more actions than just updating

You shouldn’t be concerned as even if its more efficient its not going to optimize your game to a point where you can see the difference

4 Likes

I am synchronizing a lot of parts every frame, so this is vital for me.

4 Likes

what is the context where the performance impact between re-creating or updating a part will matter?

3 Likes

Btw, is parenting to nil before updating makes it any faster?

3 Likes

I want to create a portal system using ViewportFrame.

2 Likes

No.

FillerTextFillerTextFillerText

2 Likes

Are you sure?

charliiiiiiiiiiiiim

2 Likes

If anything, it slows it down.

3 Likes

Destroy is the same as setting the parent to nil

1 Like

Actually, they are not exactly the same :nerd_face:
Parenting to nil doesn’t actually destroy the instance

1 Like

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