chicken-hackers
[Top][All Lists]
Advanced

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

Re: [PATCH] Pick rest argument values directly from the argvector withou


From: Peter Bex
Subject: Re: [PATCH] Pick rest argument values directly from the argvector without consing
Date: Sun, 27 Oct 2019 14:10:49 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

On Sun, Oct 27, 2019 at 01:16:10PM +0100, Peter Bex wrote:
> This super simple benchmark runs 25% faster with -O3:
> 
> (define (foo #!optional (a 1) (b 2))
>   (+ a b))
> 
> (time
>   (let lp ((i 0))
>     (unless (= i 100000000)
>       (foo 1 3)
>       (lp (add1 i)))))

I've tested some more, and the more rest arguments you add, the
bigger the difference is (because more needs to be consed onto
the stack).  With 4 arguments (which are all supplied in the call),
it is 40% faster.  With 8 arguments it is 60% faster etc.

Of course most procedures will only have a handful of rest arguments.

Cheers,
Peter

Attachment: signature.asc
Description: PGP signature


reply via email to

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