Variable Data question

I am dealing with a bunch of data in a variable is static data gonna effect proformance much and should I wipe it by setting it to nil after im done with it?

Can you please share the code that you are working with? This will be dependent on the size of the data, as well as the amount of times that it is used/loaded.

1 Like

It shouldn’t really affect performance much.
The performance loss comes from finding a single data in many data,
or data remaining allocated when it’s not being used anymore.

local players = {}
game:GetService("Players").PlayerAdded:Connect(function(player) 
table.insert(players, player)
end)
-- if you don't clean up players once the player has left the game, 
-- than trying to find a player in the masses of other no longer valid players
-- is going to result in N+1-time performance loss during iteration, or something such.

Its storing functions and tables with functions a lot…
Its a roblox signal creator module so im wondering does it effect proformance enough to add some way to destroy them

If the variable isn’t used and there are no references to it it will automatically be garbage collected (wiped). No need to set it to nil. Keep in mind table indexes aren’t variables, more so as references.

Im keeping all the signals in an array and the signals themselves are tables with functions in them
it goes and accesses the signals in the array by going like table[“john”] so they would end up referencing them all if im getting this correctly