guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enormous benchmark speedup


From: Ludovic Courtès
Subject: Re: Enormous benchmark speedup
Date: Thu, 02 Jul 2009 00:47:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Hi!

Juhani Viheräkoski <address@hidden> writes:

> With recent changes in guile vm there are lots on improvements on the
> Gambit benchmarks.

Improvements compared to what?

> In the worst case some test run 10% slower

Slower than what?

> but there are huge wins in testcases involving vectors offsetting
> this.

Oh, that's cool, but it feels like we're slightly cheating on these.
;-)

> (define (ack m n)
>   (cond ((= m 0) (+ n 1))
>         ((= n 0) (ack (- m 1) 1))
>         (else (ack (- m 1) (ack m (- n 1))))))
>
> (ack 3 9)

This is not tail-recursive (because of the nested `ack' call in the
`else' clause), which is why it can lead to a stack overflow.

I'm too stupid to compute the maximum "depth" of the call graph, but it
looks like this:

  (ack 3 9)
    (ack 3 8) <--- X
      (ack 3 7)
        ...
          (ack 3 0)
            (ack 2 0)
              ...
                (ack 0 0)
    (ack 2 X)
      (ack 2 (- X 1))  <--- Y
        ...
      (ack 1 Y)
        (ack 1 (- Y 1))
          ...

Thanks,
Ludo'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]