On 09-02-2025 04:23, Lindsay Lawrence wrote:
On Sat, Feb 8, 2025 at 10:16 AM Alexander Burger
<picolisp@software-lab.de> wrote:
PicoLisp now has a kind of tail call optimization!
I gave 'tco' a try. I appreciate the syntax. The similarity with
existing recur syntax
makes it trivial to convert code where tail calls are possible.
In my bench tests below with a bst search, tail call is on par with
iterative and consistently slightly faster then recur.
You just chose an example that is not demonstrative and does not show
the power of optimization.
The reverse Fibonacci example puts a significant strain on the core
itself, calling a func is not for free.
fibo(36) ===> ~30M func calls.
Here are my results: http://pb1n.de/?ce28f3
===
$ pil t1.l +
1.997 sec
0.000 sec
ok
===
(mike)