Using array fields instead of massive number of objects

前端 未结 8 2115
无人共我
无人共我 2021-02-06 07:41

In light of this article, I am wondering what people\'s experiences are with storing massive datasets (say, >10,000,000 objects) in-memory using arrays to store data fields inst

8条回答
  •  走了就别回头了
    2021-02-06 08:19

    It depends on your concrete scenario. Depends on how often your objects are created, you can:

    1. If objects are serializable save them in MemoryMappedFile (obtaining some fusion of middle/low performance and low memory consumption).

    2. Map th fields between different objects: I mean if object initially have default values, have all them in separate base and really allocate a new space if that value becomes different from default one. (this make sense for reference types naturally).

    3. Another solution again save objects to SqlLite base. Much easier to manage than MemoryMappedFiles as you can use simple SQL.

    The choice is up to you, as it depends on your concrete project requierements.

    Regards.

提交回复
热议问题