Al Boldi wrote:
> Marc Weustink wrote:
>> Al Boldi wrote:
>>> Marc Weustink wrote:
>>>> I reread the thread, you stated something, some other users couldn't
>>>> reproduce, so what do you expect for an answer ?
>>> Did you try it on your system?
>> No, for several reasons.
>>
>> 1: I don't beleave in performance issues which are just a for loop
>>
>>> Also, I have another case involving TStringList which exhibits the same
>>> problem.
>> Examples, testcases and proof.
> 
> for linux / fpc 2.0.2
> compile with 'ppc386 FPCbenchBug.pas' (no switches)
> then comment '//      Add(s);'
> compile again and report results

Well, easy to explain I guess, if you comment the Add, s must be freed thus
causing permanent memory allocation/deallocation. The Add prevents this being
itself a cheap operation.

With the improved heap manager of 2.0.4 this shouldn't happen anymore.

> 
> Thanks!
> 
> --
> Al
> 
> ---
> 
> program FPCbenchBug;
> 
> {$mode objfpc}{$H+}
> 
> uses
>   Classes, SysUtils;
> 
> var
>   fd:textfile;
>   s:string;
>   t:TDateTime;
>   i:integer;
>   
> begin
> 
>   AssignFile(fd, 'FPCbenchBug.txt');
>   Rewrite(fd);
>   for i:= 0 to 9999 do 
>     Writeln(fd,' a lot of junk ');
>   CloseFile(fd);
> 
>   t:=now;
> 
>   AssignFile(fd,'FPCbenchBug.txt');
>   Reset(fd);
>   with TStringList.Create do
>     while not(eof(fd)) do begin
>       Readln(fd,s);
>       Add(s);          //commenting this line causes slowdown
>     end;
>   CloseFile(fd);
> 
>   Writeln('Elapsed: '+IntToStr(DateTimeToTimeStamp(now-t).Time));
> 
> end.
> 
> 
> _________________________________________________________________
>      To unsubscribe: mail [EMAIL PROTECTED] with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives

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

Reply via email to