I'm currently building/concatenating pretty big strings in a program I'm developing. To give some context, the full string has the size of a terminal. This happens quite a lot since I'm developing a terminal application. I found the datastructure Buffer
, which seems to be the most performant way to concatenate strings with the standard library.
Is this the right choice if I also frequently need to update some part of a buffer at a specific position? Let's say character 20 to 50 ? Is there a better way in this case?
AFAICS, there is no way to alter the contents of a
Buffer.t
except adding to the end. Maybe you should take a look at the moduleBytes
. ABytes.t
is mutable everywhere, only the length cannot change. But it seems the length you need is fixed anyway: the size of the terminal (and if the terminal window is resized you can replace theBytes.t
by a new one).