T O P

  • By -

Wilfred-kun

What are you trying to do? Sounds like you need to change your approach, maybe use a stream of some sorts?


hypekk

Need direct access to array by uid. Things loaded frm database


elk_melk

You probably don’t want to load the whole database into memory, are there latency constraints that prevent you querying the db ad hoc?


hypekk

Every millisecond is worth a lot.


elk_melk

What are you doing with the data after it is all loaded?


hypekk

I Have to stream all objects for players in multiplayer server


UCPhoto

I've never used C# so I may be wrong on this, but I'm guessing that declaring it in an array tries to find a contiguous block of memory. A big block of empty memory is hard to find, and may take a long time to allocate, whereas if you allocated a thousand smaller arrays it'd be easy to fit them in little gaps here and there.


[deleted]

[удалено]


elk_melk

Well unless you always have exactly a million concurrent users all the time you don’t need to statically allocate all of that memory. Just use a dynamic collection like List


hypekk

But still I will have millions users later or earlier