On Sun, 5 Mar 2006, L505 wrote:

> 
> 
> > > for very large strings that
> > > constantly change via concatenations. Instead of reserving memory for the
> > > ansistring to whatever amount you request, the stringbuffer type would
> reserve
> > > extra memory for you in a specifyable increment (256K, 128K, 20K, whatever
> you
> > > choose). If the string has a concatenation on queue which is larger than 
> > > the
> > > increment size, then the stringbuffer allocates enough memory with overlap
> > > (several increments until it fills the need).
> 
> > I guess it's not so hugely useful or else someone would have
> > contributed it already.
> 
> Mmm... if that was the case I wouldn't be programming because everyone has
> already implemented what I'm trying to program :-)
> 
> Seriously though - it would mean less calls to SetLength when doing big
> operations on strings. Ansistrings work fine when you are doing small random
> concatenations but when you do tons at once they are much slower and you must
> resort to the following:
> 
> setlength(string, NewMaxValue);
> string[i]:= 'string I want to concatenate';
> 
> instead of
> 
> string:= string + 'string I want to concatenate';

If it helps, we could add a function to TStrings:

Function TStrings.Concatenate : String;

begin
end;

Which would optimize the whole matter into a single 'getmem' call ?
if there is interest, I can add it. It's 30 minutes of work.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to