Large mutable byte array in Erlang

后端 未结 3 1366
梦如初夏
梦如初夏 2021-02-14 22:08

As I am writing a simple Minecraft server application in Erlang, I am now concerned with the question of how to efficiently store and modify chunk data. For those who don\'t kno

3条回答
  •  孤街浪徒
    2021-02-14 22:44

    1000 32kb binaries is not a big deal. you say change some bytes? maybe it would be better if you just made a record of the different parts the binary can contain or that are often modified, that way you can modify parts of the binary without copying others. With ets you don't have to worry about a bunch of binary copies waiting to be gc'ed. It still makes a copy and it's still gc'ed but not in the same way as a process. You can can also use the fullsweep_after opt to make a process cleanup more often.

提交回复
热议问题