Handling Large Data Tables

Hi everyone,

I’m currently working on a game that involves a very large dataset stored in a table. The structure looks something like this:

local DataTable = {
    NestedTable1 = {
        Key1 = Value1,
        Key2 = Value2,
        Key3 = Value3,
        Key4 = Value4,
        Key5 = Value5,
    },
    NestedTable2 = {
        Key1 = Value1,
        Key2 = Value2,
        Key3 = Value3,
        Key4 = Value4,
        Key5 = Value5,
    },
    -- Repeats around 240,000 times
}



My Concerns

  • Will storing this much data cause memory issues or lag, particularly on mobile devices?
  • Could this amount of data potentially crash or severely impact performance on low-end phones?
  • How costly would it be to iterate over the entire structure at runtime?

There will be times when I need to loop through the entire dataset (not every frame, but occasionally), and I want to minimize performance impact and avoid memory spikes.

Additional Context

  • Each nested table contains 5 key-value pairs.
  • All data is held in memory (not streamed or serialized externally).
  • Runtime access and modifications to individual nested tables will be necessary.

What I’m Looking For

  • Feedback on whether this design is safe and scalable within Roblox’s memory constraints.
  • Suggestions for optimizing performance, especially when iterating over a large dataset.
  • Alternative approaches if this method is likely to cause issues on lower-end devices.

If anyone has worked with similar large data structures or has performance tips for handling this efficiently, I’d appreciate any insight or advice.

Thanks in advance!

2 Likes