[fpc-devel] Benchmark for FreePascal

L505 fpc505 at z505.com
Wed Dec 14 12:04:18 CET 2005

> But why do you read char by Char? Why not
> read(f, line);
> result := result + line;
> You can add a line break in between as well if you want.
> >   close(F); //close file
> > end;
> Jonas

Yes tried that,  and on my computer readln with string concatenation actually locks
up the computer (only on big files.. not on small)! Something is wrong with
the string concatenation... I'll dig up some old FPC-Pascal mailing archives to show
you what I mean.

Actually on my computer reading char by char was faster than line by line! I am not
sure what is wrong with the string concatenation.. but I commented out the
concatenation and that was definitely the problem. As suggested by Vincent S. I tried
putting it in brackets too... i.e.

result + (line + #13#10);

and it didn't help the speed of the concatenation by any significant amount.

In my next post I will send you some links to the archives which discussed some of
this if I can find them.


More information about the fpc-devel mailing list