[fpc-devel] Benchmark for FreePascal

Michael Van Canneyt michael at freepascal.org
Sun Dec 11 12:49:24 CET 2005



On Sat, 10 Dec 2005, darekM wrote:

> Hi
> I've tested some of benchmark on 
> http://shootout.alioth.debian.org/
> 
> I've see that reverse-complement benchmark
> <http://shootout.alioth.debian.org/benchmark.php?test=revcomp&lang=all> for
> FPC is very slow. I discover, that problem is with readln, that function
> consume about 90% of time. Because I use it in my program, I implemented new
> version of reading files. My propositions is add tTextStream to unit Classes

1.  You must remove the assembler from your unit.
2.  Your architecture is wrong. Don't descend from TFileStream.
    You should create a separate TStream descendent which takes 
    another stream as an argument in it's constructor, like the 
    compression streams or encoding streams.
3.  There is already a buffered stream (TBufStream, unit bufstream), 
    I suggest you enhance that.
4.  From 3 it follows that your unit can possibly be added to the FCL, 
    but will certainly not make it into Classes.

Concerning the shoutout test, simply adding a
SetTextBuf(input,10000);
(or even higher) before the while loop should speed it up significantly.
The default buffer is 255 chars, which is simply too small.

Can you measure the difference, and let us know ?

Anyway, glad to see that people are looking at the benchmarks :-)

Michael.



More information about the fpc-devel mailing list