Optimize memory usage of a collection of Strings in Java

后端 未结 7 1678
有刺的猬
有刺的猬 2021-01-04 21:21

I have a large number of name - value pairs (approx 100k) that I need to store in some sort of cache (say a hash map) where the value is a string with an average of about 30

7条回答
  •  清酒与你
    2021-01-04 22:09

    Do you actually need Strings, or do you just need any old CharSequence? If not, then consider implementing a "compact" CharSequence such as the one I suggest in the link.

提交回复
热议问题