Anyone using short and byte primitive types, in real apps?

后端 未结 15 3252
遥遥无期
遥遥无期 2021-02-20 08:09

I have been programming in Java since 2004, mostly enterprise and web applications. But I have never used short or byte, other than a toy program just to know

15条回答
  •  萌比男神i
    2021-02-20 08:12

    On in-memory datagrids, it can be useful. The concept of a datagrid like Gemfire is to have a huge distributed map. When you don't have enough memory you can overflow to disk with LRU strategy, but the keys of all entries of your map remains in memory (at least with Gemfire).

    Thus it is very important to make your keys with a small footprint, particularly if you are handling very large datasets. For the entry value, when you can it's also better to use the appropriate type with a small memory footprint...

提交回复
热议问题