I want to know if it uses more memory to store an Array of Objects having the same keys, than just storing an Array of Arrays containing the values.
const arrayOfObjects = [
{key1: "val1", key2: "val2", key3: "val4", key4: "val5"},
{key1: "value1", key2: "value2", key3: "value4", key4: "value5"},
{key1: "value-1", key2: "value-2", key3: "value-4", key4: "value-5"}
]
const arrayOfArrays = [
["val1", "val2", "val3", "val4"],
["value1", "value2", "value3", "value4"],
["value-1", "value-2", "value-3", "value-4"]
]
Will arrayOfObjects take much more memory than arrayOfArrays? More precisely, are the keys also stored in memory? Also, I often use JS Objects to make hash tables, to accelerate algorithms, but what are the limits of doing that ? Thank you for your help.