I just realized, dictionaries consume kind of a lot of memory or at least i think if you have a lot of information, and, i was wondering, is there a way to optimize them?, i use them to list every item of my game, but, recently i saw that they consume kind of a lot, and i need a way to easily optimize them.
I tried using items with attirbutes but it simply is just so hard and time consuming to adapt all my code.
Dictionaries are much more memory efficient compared to Instances or attributes so they should be a lot better. You are likely just implementing them incorrectly/inefficiently if they are consuming more than attributes. If you could show examples of your code that would help.
It might be possible that some things i can do is, just delete the stuff that is not ussed, and adapt a little bit of code to just verify if it haves that value in the item.
1.-I use the Name param because of having like names in the items i can change without changing any data.
2.-I used the LuauHeap feature in the console, took some snapshots and thats it, seems like arrays is getting a lot of memory, i think.
These verifications wouldn’t be needed, as if the client modifies it, the server and other clients wouldn’t even see the changes made, only the client who modifies it. And then you shouldn’t be validating the data from the client either, maybe these verifications you’re running are using memory as well
And like @Katrist said the Name = … parameter is not needed as the index name is the same.
Not to mention for the ItemsRequired parameter you could just do…
["Whearon"] = 25
Implying the quantity is the number and the name is the index
["Image"] = "rbxassetid://132548291556143",
instead of adding rbxassetid:// to each image you could just add the ID, and in the script concatenate this.
ALSO not to mention that these “optimizations” you’re trying to make are very minimal and most low end devices will be able to handle things like this. Unless you or your players are experiencing lag or heavy memory usage, why bother going through the trouble of optimizing?