unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [elpa] externals/elisp-benchmarks 7467bf994e: Add EIEIO benchmark
       [not found] ` <20220207211752.E4BECC0DA39@vcs2.savannah.gnu.org>
@ 2022-02-10  8:29   ` Andrea Corallo
  2022-02-10 13:51     ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Andrea Corallo @ 2022-02-10  8:29 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [elpa] externals/elisp-benchmarks 7467bf994e: Add EIEIO benchmark
  2022-02-10  8:29   ` [elpa] externals/elisp-benchmarks 7467bf994e: Add EIEIO benchmark Andrea Corallo
@ 2022-02-10 13:51     ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2022-02-10 13:51 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: emacs-devel

> Will `elb-fibn-tc-entry' ever be called?

Yes, the functions of the form `elb-*-entry` are the benchmarks, so
a single file can provide several benchmarks (this was already used
with `pack-unpack.el`).

The only real change w.r.t `fibn*` was the number of iterations which has
been made equal between the various alternative implementations so they
can be directly compared to see the cost of using `named-let` or
recursion over `while/cl-loop`.


        Stefan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-10 13:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <164426867203.8002.1171815336107702126@vcs2.savannah.gnu.org>
     [not found] ` <20220207211752.E4BECC0DA39@vcs2.savannah.gnu.org>
2022-02-10  8:29   ` [elpa] externals/elisp-benchmarks 7467bf994e: Add EIEIO benchmark Andrea Corallo
2022-02-10 13:51     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).