emacs-devel
[Top][All Lists]
Advanced

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

Re: [elpa] externals/elisp-benchmarks 7467bf994e: Add EIEIO benchmark


From: Andrea Corallo
Subject: Re: [elpa] externals/elisp-benchmarks 7467bf994e: Add EIEIO benchmark
Date: Thu, 10 Feb 2022 08:29:10 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier via <emacs-elpa-diffs@gnu.org> writes:

> branch: externals/elisp-benchmarks
> commit 7467bf994ef710f5898e91c629799eb90cc241ea
> Author: Stefan Monnier <monnier@iro.umontreal.ca>
> Commit: Stefan Monnier <monnier@iro.umontreal.ca>
>
>     Add EIEIO benchmark

Hi Stefan,

this commit is reshuffling and modifying existing benchmarks other than
adding a new one so please use a commit message that is descriptive for
the change so this can be reviewed.

Also consider that removing and folding pre-existing benchmarks makes
the comparison with old tests considerably harder (read impossible), so
I think before doing that would have been important to share and discuss
the intent.

Please find some comment on the change-set below:

>     * benchmarks/elb-eieio.el: New file.
>     * benchmarks/elb-pcase.el: Rename from pcase.el to avoid naming conflict.
>     * benchmarks/fibn-tc.el, benchmarks/fibn-rec.el: Fold into 
> benchmarks/fibn.el.
>     * benchmarks/fibn.el: Add a `fibn-named-let` entry.  Keep the same
>     number of iterations for all the non-naive fibn entries so they can
>     be compared more directly.
>     
>     * elisp-benchmarks.el (elisp-benchmarks-run): Sort entries.
> ---
>  benchmarks/elb-eieio.el               | 49 
> +++++++++++++++++++++++++++++++++++
>  benchmarks/{pcase.el => elb-pcase.el} | 30 +++++----------------
>  benchmarks/fibn-rec.el                | 33 -----------------------
>  benchmarks/fibn-tc.el                 | 35 -------------------------
>  benchmarks/fibn.el                    | 46 +++++++++++++++++++++++++++++---
>  elisp-benchmarks.el                   | 10 +++----
>  6 files changed, 102 insertions(+), 101 deletions(-)

[...]

>  (defun elb-fibn-entry ()
> -  ;; Use 80 to stay in the fixnum range.
> -  (elb-fibn 3000000 80))
> +  ;; Use 80 to stay in the fixnum range (on 64bit systems).
> +  (elb-fibn 1000000 80))
> +
> +;; Fibonacci sequence tail recursive algo.
> +
> +(defun elb-fibn-tc (a b count)
> +  (if (= count 0)
> +      b
> +    (elb-fibn-tc (+ a b) a (- count 1))))
> +
> +(defun elb-fibn-tc-entry ()
> +  (dotimes (_ 1000000)
> +    (elb-fibn-tc 1 0 80)))

Will `elb-fibn-tc-entry' ever be called?  Shouldn't it be called from
`elb-fibn-entry' now?

> +;; Fibonacci sequence with named-let.
> +
> +(defun elb-fibn-named-let (count)
> +  (named-let loop ((a 1)
> +                   (b 0)
> +                   (count count))
> +    (if (= count 0)
> +        b
> +      (loop (+ a b) a (- count 1)))))
> +
> +(defun elb-fibn-named-let-entry ()
> +  (dotimes (_ 1000000)
> +    (elb-fibn-named-let 80)))

Same

> +;; Fibonacci sequence with the naive recursive algo.
> +
> +(defun elb-fibn-rec (n)
> +  (cond ((= n 0) 0)
> +     ((= n 1) 1)
> +     (t (+ (elb-fibn-rec (- n 1))
> +           (elb-fibn-rec (- n 2))))))
> +
> +(defun elb-fibn-rec-entry ()
> +  (elb-fibn-rec 37))

Same

Best Regards

  Andrea



reply via email to

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