[fpc-devel] Tail recursion optimization

Vincent Snijders vsnijders at quicknet.nl
Wed Oct 11 11:35:10 CEST 2006


Florian Klaempfl schreef:
> Daniƫl Mantione wrote:
>> Op Tue, 10 Oct 2006, schreef Florian Klaempfl:
>>
>>> Yesterday, I've implemented tail recursion optimization
>>> (http://svn.freepascal.org/svn/fpc/trunk/compiler/opttail.pas resulting in
>>> http://www.hu.freepascal.org/fpcircbot/cgipastebin?msgid=158 pp11 is the new
>>> compiler, fpc11 the old, both are 2.1.1).
>> Wow!
> 
> Well, it's use for real world applications is limited but for the typical
> recursive useless benchmark stuff it's nice to have and it wasn't much work.

I tried this with the recursive benchmark:
http://svn.freepascal.org/svn/fpc/trunk/tests/bench/shootout/src/recursive.pp

Using fpc
2.0.4: 9.1 s
2.1.1: 8.1 s
with {$OPTIMIZATION tailrec}: 6.0 s.

gcc is 2.6 times faster than fpc 2.0.4 (see 
http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursive&lang=all)
so it would do 3.5 seconds about this benchmark.

Vincent



More information about the fpc-devel mailing list