[Top][All Lists]

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

Re: [Chicken-users] multiple values in chicken

From: Will Farr
Subject: Re: [Chicken-users] multiple values in chicken
Date: Fri, 1 Feb 2008 13:55:00 -0500

Hi Kon,

Thanks for running the tests---that was quick!  It's true that, as written,

(define (values . rest) (call/cc (lambda (k) (apply k rest))))

would be expensive.  You must create a closure, cons up a rest list,
and I bet that apply uses some C varargs magic that probably is much
slower than a straight function call.  But, how hard would it be to
specify a re-write rule which takes effect after CPS conversion which

(##sys#values k v1 ...)


(k v1 ...)

That would solve all these problems in the typical case of explicit
values usage (i.e. the first-order case), though values would still be
slow if used in a higher-order fashion as the identity function.  I
can't decipher enough of the re-write rules in c-platform.scm to add
such a thing myself, though I suspect that it's about 10 minutes work
for somebody who knows what's going on with all these re-write


On Feb 1, 2008 1:22 PM, Kon Lovett <address@hidden> wrote:
> ---- VALUES --------------------------------------------------
>    32.571 seconds elapsed
>     1.724 seconds in (major) GC
>         0 mutations
>      3304 minor GCs
>      1103 major GCs
> ---- LIST ----------------------------------------------------
>     8.244 seconds elapsed
>     0.009 seconds in (major) GC
>         0 mutations
>      2457 minor GCs
>         7 major GCs
> ---- CC-VALUES --------------------------------------------------
>     42.69 seconds elapsed
>     1.735 seconds in (major) GC
>         0 mutations
>      1824 minor GCs
>      1104 major GCs

reply via email to

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