Re: [fpc-pascal] Speed question for strings

2005-11-19 Thread L505
> 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. >

Re: [fpc-pascal] Speed question for strings

2005-11-19 Thread L505
- 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: >

Re: [fpc-pascal] Speed question for strings

2005-11-19 Thread Vincent Snijders
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

Re: [fpc-pascal] Speed question for strings

2005-11-19 Thread Peter Vreman
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

Re: [fpc-pascal] Speed question for strings

2005-11-19 Thread L505
> 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

Re: [fpc-pascal] Speed question for strings

2005-11-19 Thread Vincent Snijders
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

[fpc-pascal] Speed question for strings

2005-11-18 Thread L
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