Performance Inquiry

I was wondering if getting a value from a table with the value already inside rather then setting the value as you declare whatever your declaring would be faster

Example 1 :

local a = {,0,1,0)
randomThing.Size = a[1]

Example 2 :

randomThing.Size =,0,1,0)

Example 2 would be faster since the look-up of the dictionary presents an extra overhead. But the difference in time is so small that it’s negligible for most applications. You’re fine using either approach, however, I’d advise using the one that leads to more readable code. If you’re reusing many different UDim2 values, storing them all into a table which you then index to size/position GUI elements is a good idea.


Alright this is just the answer I was looking for thanks!