Write the code using the most natural (lines), find out if it is too slow, and then improve it.
Arrays can be used as a replacement for replacement strin most cases, if you restrict yourself to access the index and section. Both are fixed. Both should have approximately the same memory requirements. Arrays are mutable if you need to change buffers. Arrays can be read directly from files, so reading does not require a speed limit.
I do not understand how you avoid Unicode problems using arrays. str- it's just an array of bytes and knows nothing about the encoding of a string.
I assume that the disk buffers you mentioned can be quite large, so you might consider using mmap:
, , , . , , . mmap , ; , re . theyre mutable, , obj [index] = 'a' , : obj [i1: i2] = '...'. , , () .