chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] multiple values in chicken


From: John Cowan
Subject: Re: [Chicken-users] multiple values in chicken
Date: Thu, 31 Jan 2008 23:06:03 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

Alex Shinn scripsit:

> In general, unless the compiler natively takes MV into consideration
> and goes through the effort to place them on the stack (a complication
> which can make other optimizations more difficult, and which few
> compilers do anyway), then LIST is usually at least as fast as VALUES.

Well, as I said, in Chicken values (multiple or otherwise) become the
arguments of the continuation function, so they may or may not be on
the C stack depending on what gcc does with them.

> ---- VALUES --------------------------------------------------
>   35.949 seconds elapsed
>      0.4 seconds in (major) GC
>        0 mutations
>      760 minor GCs
>      960 major GCs
> ---- LIST ----------------------------------------------------
>     2.17 seconds elapsed
>   7.e-03 seconds in (major) GC
>        0 mutations
>     3266 minor GCs
>        8 major GCs

Something is horribly wrong: did you time things in the interpreter?

I compiled and ran each of your benchmarks 10 times on a fairly idle
system (i.e. I wasn't doing anything, but the network probably was)
and got an average time of 2.114s for LIST and 2.832 for VALUES.

I think that's because the number of minor GCs (C stack overflows)
was 1.8 times larger in VALUES than in LIST; consequently, there were
15 major GCs rather than only 4.

So I tried again in -benchmark-mode, which does block compilation,
-O3, disables debugging and interrupts, and does lambda-lifts, and the
times went down to 0.584 for LIST and 1.548 for VALUES.  Adding unsafe
compilation and libraries and inlining didn't change that much.
Apparently Chicken can optimize the LIST algorithm much better.

So what you say is true, but it's not *as* true as you say it is.

-- 
John Cowan    http://ccil.org/~cowan  address@hidden
The Penguin shall hunt and devour all that is crufty, gnarly and
bogacious; all code which wriggles like spaghetti, or is infested with
blighting creatures, or is bound by grave and perilous Licences shall it
capture.  And in capturing shall it replicate, and in replicating shall
it document, and in documentation shall it bring freedom, serenity and
most cool froodiness to the earth and all who code therein.  --Gospel of Tux




reply via email to

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