HashMap alternatives for memory-efficient data storage

前端 未结 10 1442
逝去的感伤
逝去的感伤 2020-12-24 06:50

I\'ve currently got a spreadsheet type program that keeps its data in an ArrayList of HashMaps. You\'ll no doubt be shocked when I tell you that this hasn\'t proven ideal.

10条回答
  •  半阙折子戏
    2020-12-24 07:13

    I've been experimenting with using the SparseObjectMatrix2D from the Colt project. My data is pretty dense but their Matrix classes don't really offer any way to enlarge them, so I went with a sparse matrix set to the maximum size.

    It seems to use roughly 10% less memory and loads about 15% faster for the same data, as well as offering some clever manipulation methods. Still interested in other options though.

提交回复
热议问题