From: Will Senn <will.senn@gmail.com>
To: COFF <coff@minnie.tuhs.org>
Subject: [COFF] Tail-recursion was Re: [TUHS] Lorinda Cherry
Date: Tue, 22 Feb 2022 18:48:39 -0600 [thread overview]
Message-ID: <52dac66b-3f10-fc5f-9325-a8f4f9bdcc99@gmail.com> (raw)
In-Reply-To: <20220222103948.1B0482206F@orac.inputplus.co.uk>
My all time favorite presentation on tail-recursion:
https://www.youtube.com/watch?v=-PX0BV9hGZY
On 2/22/22 4:39 AM, Ralph Corderoy wrote:
> Hi Otto,
>
>> MacOS uses the GNU implementation which has a long standing issue with
>> deep recursion. It even cannot handle the tail recursive calls used
>> here and will run out of its stack.
> When learning dc and seeing it relied on tail calls, the first thing
> I did was check it did tail-call elimination, and it did. That was
> GNU dc.
>
> Trying just now, I see no growth in memory usage despite heavy CPU load
> shown by TIME increasing.
>
> $ dc
> !ps u `pidof dc`
> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> ralph 11489 0.0 0.0 2332 1484 pts/1 S+ 10:33 0:00 dc
> [lmx]smlmx
> ^C
> Interrupt!
> !ps u `pidof dc`
> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> ralph 11489 75.5 0.0 2332 1488 pts/1 S+ 10:33 0:46 dc
>
> The memory used remained at that level during the macro execution too,
> watched from outside.
>
> Do you have more detail on what GNU dc can't handle? dc without
> tail-call elimination is a bit crippled.
>
_______________________________________________
COFF mailing list
COFF@minnie.tuhs.org
https://minnie.tuhs.org/cgi-bin/mailman/listinfo/coff
next parent reply other threads:[~2022-02-23 0:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAKH6PiVi+JoxDG7ACMG5G+qnTkxTMsohGx6Wq3UNVkogO4N0Vg@mail.gmail.com>
[not found] ` <CAKr6gn2pJROQNr3M+JGU1vs3bRRh3SrTS5N-8w+vWP2oApwmsw@mail.gmail.com>
[not found] ` <alpine.BSF.2.21.9999.2202161122500.45073@aneurin.horsfall.org>
[not found] ` <202202160754.21G7sbUa011318@freefriends.org>
[not found] ` <1nKFRN-4IZ-00@marmaro.de>
[not found] ` <8735kig8vb.fsf@vuxu.org>
[not found] ` <m27d9tw9fx.fsf@thuvia.hamartun.priv.no>
[not found] ` <alpine.BSF.2.21.9999.2202180810480.45073@aneurin.horsfall.org>
[not found] ` <4E3028A1-EC08-424A-B814-CC2AEEEAEC7B@iitbombay.org>
[not found] ` <Yg9Z7Y8RK2+GQeDI@clue.drijf.net>
[not found] ` <20220222103948.1B0482206F@orac.inputplus.co.uk>
2022-02-23 0:48 ` Will Senn [this message]
2022-02-23 0:53 ` silas poulson
2022-02-23 1:45 ` Charles H. Sauer (he/him)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52dac66b-3f10-fc5f-9325-a8f4f9bdcc99@gmail.com \
--to=will.senn@gmail.com \
--cc=coff@minnie.tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).