unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Luca Saiu <positron@gnu.org>
Cc: bug-guile@gnu.org
Subject: Re: High run time variance
Date: Tue, 30 Mar 2010 11:16:05 +0200	[thread overview]
Message-ID: <87vdce186i.fsf@gnu.org> (raw)
In-Reply-To: <4BB0D0A7.7080505@gnu.org> (Luca Saiu's message of "Mon, 29 Mar 2010 18:09:11 +0200")

Hi Luca,

Luca Saiu <positron@gnu.org> writes:

> (define (fibo n)
>   (if (< n 2)
>       n
>       (+ (fibo (- n 1))
>          (fibo (- n 2)))))

This function is not tail-recursive, so it consumes stack space, which
increases the amount of memory the GC has to scan.  My guess is that
this has to do with the time spent in GC.

Could you try with a tail-recursive version?

Thanks,
Ludo’.




  reply	other threads:[~2010-03-30  9:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-29 16:09 High run time variance Luca Saiu
2010-03-30  9:16 ` Ludovic Courtès [this message]
2010-03-30 12:35   ` Luca Saiu
2010-03-30 13:01     ` Ludovic Courtès
2010-03-30 15:05       ` Luca Saiu
2010-08-04 19:51 ` Andy Wingo
2010-08-05 13:42   ` Luca Saiu
2010-08-05 14:45     ` Andy Wingo
2010-08-05 16:21       ` Luca Saiu
2010-08-05 17:43         ` Andy Wingo

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdce186i.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=positron@gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).