> The first string is always long, so you are doing twice adding a small
> string to a long string. This causes much heap fragmentation.
>
> Try result:= result + (Line + #13#10);
> or
>
> Line := Line + #13#10;
> Result := Result + Line;
Ahh that will probably do the trick. I'll let you know.
>
- Original Message -
From: "Peter Vreman" <[EMAIL PROTECTED]>
To: "FPC-Pascal users discussions"
Sent: Saturday, November 19, 2005 1:47 AM
Subject: Re: [fpc-pascal] Speed question for strings
> At 09:46 19-11-2005, you wrote:
> > > L wrote:
>
L505 wrote:
L wrote:
Why is the first and third example *so* much faster than the second example?
Significantly faster.
Because you doubled the number of string concatenations.
Vincent.
Right, but it's not twice as slow :-) Worse... It's at least 50-100 times
slower.
Weird.
I will hav
At 09:46 19-11-2005, you wrote:
> L wrote:
> > Why is the first and third example *so* much faster than the second
example?
> > Significantly faster.
> >
>
> Because you doubled the number of string concatenations.
>
> Vincent.
Right, but it's not twice as slow :-) Worse... It's at least 50-1
> L wrote:
> > Why is the first and third example *so* much faster than the second example?
> > Significantly faster.
> >
>
> Because you doubled the number of string concatenations.
>
> Vincent.
Right, but it's not twice as slow :-) Worse... It's at least 50-100 times
slower.
Weird.
I will hav
L wrote:
Why is the first and third example *so* much faster than the second example?
Significantly faster.
Because you doubled the number of string concatenations.
Vincent.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.fr
Why is the first and third example *so* much faster than the second example?
Significantly faster.
There's really not that much difference between the string concatenation.
//Example 1: (seems fast)
function StrLoadFile_test1(FileName: string): string;
var
F: text;
c: char;
str1,Line: stri