[Lazarus] SynEdit and 'Gapped Buffer'

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jun 26 12:02:51 CEST 2008


On Wed, 25 Jun 2008 13:26:20 -0300
"Flávio Etrusco" <flavio.etrusco at gmail.com> wrote:

> Yes and no. SynEdit simply uses a TStringList...

It's not a TStringList, but a descendant of TStrings.
And there is no gap buffer in the middle yet. This works
good enough for a file with hundred thousand lines.
There are many other bottlenecks that do a lot more work than the
lines array.
Maybe a gap buffer could be useful, when there are millions of lines.
But before that you must optimize many other parts.

Mattias

 
> Best regards,
> Flávio
> 
> On Wed, Jun 25, 2008 at 12:08 PM, Graeme Geldenhuys
> <graemeg.lists at gmail.com> wrote:
> > Hi,
> >
> > Does SynEdit as used in Lazarus IDE use a gapped buffer to store
> > it's text?  I just read about 'gapped buffer' in the Java
> > documentation and did some Googling to see what it is.  A dynamic
> > array is some sort of gapped buffer, but not optimized and the gap
> > is always at the end of the array.
> >
> > If SynEdit does use a gapped buffer, does FPC contain an
> > implementation?
> >
> >
> > <Quote>
> > http://slashdot.org/developers/00/10/27/1516243.shtml
> > NEdit stores text in a simple gapped-buffer structure, common to
> > many text editors. The gapped-buffer is a block of memory with a
> > moving hole in it. NEdit maintains the gap's size and continuously
> > relocates it as part of the insertion / deletion process. This
> > organization maps exceptionally well to how people actually use a
> > text editor, and is very effective at minimizing the number and
> > size of memory relocations that need to happen as users add and
> > delete text. For comparison, another common approach to storage in
> > a text editor is to break the text into linked blocks so that any
> > given modification affects only a limited number of blocks. While
> > this better limits worst-case memory movement; it also breaks up
> > and scatters the stored data, destroying its locality; so the
> > virtual memory system can't swap it as efficiently.
> > </Quote>
> >
> >
> > For more information see:
> >
> >  http://en.wikipedia.org/wiki/Gap_buffer
> >  http://www.lazyhacker.com/gapbuffer/gapbuffer.htm
> >
> >
> > Regards,
> >  - Graeme -
> >
> >
> > _______________________________________________
> > fpGUI - a cross-platform Free Pascal GUI toolkit
> > http://opensoft.homeip.net/fpgui/
> > _______________________________________________
> > Lazarus mailing list
> > Lazarus at lazarus.freepascal.org
> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> >
> 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list