Re:Text Showdown: Gap Buffers vs. Ropes
by kammerdiener on Tuesday October 10, 2023 @08:20AM
(#37831137)
Do you have any more info on this?
I thought my comment was pretty comprehensive on the technique. Is there something that was unclear? I can clarify.
I’ve used this technique a few times over the decades in non-editor applications with large sorted vectors.
Re:Text Showdown: Gap Buffers vs. Ropes
by PH95VuimJjqBqy on Tuesday October 10, 2023 @10:05AM
(#37832268)
Not only was it clear but it's the approach that popped into my head immediately while reading the article.
Re:Text Showdown: Gap Buffers vs. Ropes
by kammerdiener on Tuesday October 10, 2023 @06:05PM
(#37838262)
Your explanation was just fine. I was simply asking what else you knew about the technique. Perhaps where you first heard of it or some examples where it has been applied/benchmarked.
Basically: if you need to make a gap, split the page it’s on into two (so your region copy is always less than one page long). You can start the copy into the middle of second page or not (I don’t actually think that’s an optimization in practice but have never measured it).
If you get a lot of fragmentation you can have a background process that does coalescence away from the active insertion point.