Do Long Tables Cause Lag?

I am currently working on a script that takes a very large amount of values and puts them into a table for later usage. I don’t have an exact size of the table, but after it’s finished being filled it probably is hundreds of thousands to millions of characters long. My game is beginning to lag and I am not sure if it’s because of the extremely long table or if there is another reason. So my question is, do long tables cause lag?

1 Like

I do not believe so unless it has millions of keys. Lua is a very advanced and efficient programming language, especially Luau. I wouldn’t worry about stuff like that unless you try to store that in a datastore.

No, I actually have very large tables that load up instantly when I use them with LuaU

Also, I am using bypassed school internet lol

1 Like

Your problem may not be the storing of the long table, but rather how you are using it.

For example if you were constantly checking values and acting on values in your table using loops, you will most likely experience frame drops and lag.

That being said, variables use memory. Long variables (such as extensive tables), can cause memory leaks.

Here is an article I found which I think explains memory management well if you want to take a look:

1 Like