On Thu, Jul 10, 2014 at 09:33:53AM -0700, Charlie Kester wrote:
> The problem with linked lists of lines and piece tables has always been
> achieving good locality of reference.  Not a problem with buffer gap,
> where locality was the main motivating factor behind the design.

In my experience, an array of pointers to lines is a very efficient choice,
You get O(1) access to any point in the buffer (provided you use <line,column>
as coordinates), and in typical code sources lines are reasonably small so
that using a single char array for lines is fast enough.

Its easy to understand, implement and has excellent performances on non
patholical text text.

>From my experience with Kakoune, you almost never need the byte-offset of a
character, but very often the line,column pair. So using these as basic
coordinates (and implementing the buffer backend in consequence) makes
much sense.

Reply via email to