Re: [fpc-pascal] Recursion optimization by compiler

2010-09-04 Thread Florian Klämpfl
Am 04.09.2010 15:08, schrieb Sven Barth: > On 28.08.2010 11:57, Florian Klämpfl wrote: >> Am 03.09.2010 21:31, schrieb Sven Barth: >>> On 03.09.2010 18:02, Marco van de Voort wrote: > Second, does FPC understand "tail recursion"? Depends on version, do fpc -i |grep -i t

Re[2]: [fpc-pascal] Recursion optimization by compiler

2010-09-04 Thread José Mejuto
Hello FPC-Pascal, Saturday, September 4, 2010, 9:07:57 AM, you wrote: RB> This a misunderstanding of way recursion can be flattened RB> into a loop. It's especially not useful because the transformed RB> version still uses a stack, so it doesn't execute in constant RB> space. I know, but as far

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-04 Thread Sven Barth
On 28.08.2010 11:57, Florian Klämpfl wrote: Am 03.09.2010 21:31, schrieb Sven Barth: On 03.09.2010 18:02, Marco van de Voort wrote: Second, does FPC understand "tail recursion"? Depends on version, do fpc -i |grep -i tailrec to find out more. O.o Ok... now I'm officially impressed. W

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-04 Thread Florian Klämpfl
Am 03.09.2010 21:31, schrieb Sven Barth: > On 03.09.2010 18:02, Marco van de Voort wrote: >> >>> Second, does FPC understand "tail recursion"? >> >> Depends on version, do >> >> fpc -i |grep -i tailrec >> >> to find out more. > > O.o > > Ok... now I'm officially impressed. Well, simple to implem

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-04 Thread Roger Bailey
iate base-case value for "b") we can traverse any tree in O(log(n)) space, irrespective of the type of values in the tree or the type of operation performed on them. Or we could if Pascal had a proper polymorphic type system. But it ain't, it's too old-fashioned. On 3 Se

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Sven Barth
On 03.09.2010 18:02, Marco van de Voort wrote: Second, does FPC understand "tail recursion"? Depends on version, do fpc -i |grep -i tailrec to find out more. O.o Ok... now I'm officially impressed. Maybe it's time to reuse some of my OCaml knowledge from the 3rd term of my study :D R

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Marco van de Voort
In our previous episode, Bihar Anwar said: > O Marco, I love you :-) Better love Florian :-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Bihar Anwar
O Marco, I love you :-) - Original Message From: Marco van de Voort To: FPC-Pascal users discussions Sent: Fri, September 3, 2010 11:02:52 PM Subject: Re: [fpc-pascal] Recursion optimization by compiler > Second, does FPC understand "tail recursion"? Depends on vers

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Marco van de Voort
> Second, does FPC understand "tail recursion"? Depends on version, do fpc -i |grep -i tailrec to find out more. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re[2]: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread José Mejuto
Hello FPC-Pascal, Friday, September 3, 2010, 3:06:30 PM, you wrote: BA> First, just curious, have somebody here ever benchmark performance between BA> native stack and regular RAM as a stack? Stack is RAM, so the only difference is in the algorithm used. -- Best regards, José ___

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Bihar Anwar
September 3, 2010 7:17:57 PM, José Mejuto wrote: > That kind of "optimization" to me only seems interesting in > two possible situations, when calling functions is high > costly or when there is a very limited stack amount (really, > really small). From my point of view if you need more that > 1M

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread José Mejuto
Hello FPC-Pascal, Friday, September 3, 2010, 1:12:31 PM, you wrote: BA> After my previous post, "TreeView and Nonrecursion", I'd tried to ask the same BA> topics in stackoverflow.com BA> (http://stackoverflow.com/questions/3630047/treeview-control-and-nonrecursion) BA> and I got something new.

[fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Bihar Anwar
After my previous post, "TreeView and Nonrecursion", I'd tried to ask the same topics in stackoverflow.com (http://stackoverflow.com/questions/3630047/treeview-control-and-nonrecursion) and I got something new. It is possible to recurse without using up the stack space. Optimizing compilers