N
Come on, I don't have information on linear complexity, and I'm not sure anyone will have it. But!We can open a console in Google Chrome and create an object:const o = {}
for (let i = 1; i <= 1000; i++) {
o[i] = {
field1: field1_${i},
field2: field2_${i},
field3: field3_${i},
field4: field4_${i},
field5: field5_${i},
}
}
I do not understand your wording that the object ' s values will refer to objects with information. I don't understand that objects in js are also reference types, that is, if you don't keep primitives, there'll be references in any case.
The object I've created has also kept references to objects with user information. I haven't simulated this place to have a link to the scot-connection, you can use the next written, test yourself and get real meaning to your structures.Now, if heap snapshot is made after the facility has been set up (ibid. in the consoles, the Memory deposit), you can see how much this object has to remember. I'll give you the meanings.Shallow Size: 56 - indeed, how many memories in the Whites are placed under the objectRetained Size: 235,160 is the amount of memory in the Whites, all references to it, etc.Both values, as you can see, are not very great.
It's a response to your anxiety about something that could be "different to 1,000 users a lot." He won't.Now, as for linear complexity. You don't need this information for one reason: js, any tree packing will be based on the same data structures, which means you won't get any productivity gains, alas.By the way, with regard to other types/structures, attention may be drawn to Map:const m = new Map()
for (let i = 1; i <= 1000; i++) {
m.set(i, {
field1: field1_${i},
field2: field2_${i},
field3: field3_${i},
field4: field4_${i},
field5: field5_${i},
})
}
Established Map has such indicators in heap snapshot:Shallow Size: 32Retained Size: 252 384The difference in memory use is, as you can see, minor, but Map It may be more convenient, if it is necessary to irrigate, to receive an up-to-date number of records, and it is generally considered that Map productively, if you often have additive/deposition operations. Actual and perceived benefits Map before Object I can see. https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Map#%D0%A1%D1%80%D0%B0%D0%B2%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D0%9E%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D0%BE%D0%B2_%D0%B8_Map ♪In any case, you know, 1,000 elements are very little to be seriously worried. Keep it, there's no productivity problem for you.Good luck!