unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tomas Hlavaty <tom@logand.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: funcall consing
Date: Sun, 02 Jan 2022 14:30:38 +0100	[thread overview]
Message-ID: <87ee5q5kox.fsf@logand.com> (raw)
In-Reply-To: <83pmpbgbmr.fsf@gnu.org>

On Sat 01 Jan 2022 at 09:26, Eli Zaretskii <eliz@gnu.org> wrote:
> Note that one of the examples posted by the OP does exactly twice GC
> cycles that the other.  Which leads me to believe it had twice more
> opportunities for checking how much consing was done.
>
> So I think the caveat not to put too much faith in the _number_ of GC
> cycles is still something important to keep in mind.

In my example:

(benchmark-run 10 (dotimes (i 100000) (1+ i)))
;;(2.720941123 40 1.7525918699999998)
(let ((x (lambda (i) (1+ i)))) (benchmark-run 10 (dotimes (i 100000) (funcall x i))))
;;(4.9373091140000005 80 3.4835688719999958)

the third number is the time taken by garbage collection.  It is also
roughly doubled for the second case indicating that the second case
really generated more (say about twice as much) garbage.

Otherwise benchmark-run is not really useful for what I need.  In that
case, what is the preferred way to measure execution speed and consing?
I do not need absolute numbers, just something so that I can compare two
different implementations of the same thing and choose the better one or
focus on places to improve.



  reply	other threads:[~2022-01-02 13:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 11:01 funcall consing Tomas Hlavaty
2021-12-31 12:33 ` Eli Zaretskii
2021-12-31 15:09   ` LdBeth
2021-12-31 17:00     ` Tomas Hlavaty
2021-12-31 18:42     ` Eli Zaretskii
2022-01-01  4:47       ` Richard Stallman
2022-01-01  7:26         ` Eli Zaretskii
2022-01-02 13:30           ` Tomas Hlavaty [this message]
2022-01-02 14:46             ` Eli Zaretskii
2022-01-02 15:59               ` Tomas Hlavaty
2022-01-02 18:53             ` Stefan Monnier
2022-01-01  4:51       ` LdBeth
2022-01-01  7:28         ` Eli Zaretskii
2022-01-01 17:05           ` Stefan Monnier
2022-01-01 17:21             ` Eli Zaretskii
2021-12-31 14:27 ` LdBeth
2021-12-31 16:56   ` Tomas Hlavaty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee5q5kox.fsf@logand.com \
    --to=tom@logand.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).