Jonas Maebe wrote:

On 10 dec 2005, at 22:09, darekM wrote:

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.


In my test (Mac OS X/PPC, rtl and program compiled with register variables, text buffer of 64kb) readln's overheid is negligible. The large cost comes from writeln. The reason the C version is so much faster is because its output is buffered as well. We automatically flush the output after each writeln (i.e. after each writeln of 60 characters), while in C this only happens at the very end of the program for 128kb of characters at a time.

Another speed improvement will be disabling IO checks for write, {$I-}

I normally wouldn't recomend doing so, but for this test it either passes or fails.

Marc

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to