> > > 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.
>

But I mean if you are doing things at different times in the program:

for i := 1 to 1000
  DoSomestuff
  s:= string + string;
  DoOtherStuff
  s:= string + string;

in other words.. not one big concatenation at once such as:

string.concatenate(string1, string2, string3, string4);

The only way I saw it possible in my mind was through a special string buffer
type (or hey, even a stringbuffer class if not a true system type).

With TStrings.concatenate did you mean an all at once concatenation?

p.s. the reason I mention this was because I was just doing some work with my
friend Tony in pascal server pages for output buffering and we were doing some
benchmarks playing around with setlength calls

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

Reply via email to