From: "João Távora" <joaotavora@gmail.com>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Richard Stallman <rms@gnu.org>, paaguti@gmail.com, emacs-devel@gnu.org
Subject: Re: seq.el and the complexity of Emacs Lisp.
Date: Tue, 7 Nov 2023 10:24:36 +0000 [thread overview]
Message-ID: <CALDnm53DHne6-oPAf0B8rHG7mwp-X7178FtKTiH8TAcAOg5Lig@mail.gmail.com> (raw)
In-Reply-To: <m24jhzcpwf.fsf@Pro.fritz.box>
On Mon, Nov 6, 2023 at 8:54 AM Gerd Möllmann <gerd.moellmann@gmail.com> wrote:
>
> Richard Stallman <rms@gnu.org> writes:
>
> Can't say much about what you write before this. I wasn't there when
> seq/map, pcase, or other stuff, was added, but...
>
> > Could we replace all the cl-lib sequence function calls with seq-
> > calls, in core and GNU ELPA code? Seq is simpler and cleaner, so that
> > would be an improvement. We could keep cl-lib permanently for
> > compatibility for external code, but it would not need to be loaded
> > (into Emacs or your brain) very often.
>
> ...you are losing me here. I'm still wondering what seq/map are good
> for in the first place.
Presumably, it's good for handling custom sequence types, such as lazy
lists. That's a worthy goal, very worthy even, but this polymorphism comes
at a runtime cost, of course. And worthy as it may be, there's no use
of that feature in the Emacs tree (as far as I can tell from quick greps),
so it can't really be the "technical reason" for why seq.el is preloaded
and or recommended.
> Considering something "cleaner" is just a
> feeling, isn't it? A feeling I don't share.
Absolutely. I also think "cleaner" is a very weak argument.
Anyway, I think this discussion could use some data:
(require 'cl-lib)
(defun bench-seq-some (seq)
(seq-some #'identity seq))
(defun bench-cl-some (seq)
(cl-some #'identity seq))
(defun bench-cl-loop-list (l)
;; checks for some types of improper lists
(cl-loop for e in l thereis (identity e)))
(defun bench-cl-loop-vec (v)
(cl-loop for e across v thereis (identity e)))
(when nil
;; Small lists
(let ((l (list nil nil nil nil t)))
(benchmark-run 1000000 (bench-cl-some l))) ;; (0.179339 0 0.0)
(let ((l (list nil nil nil nil t)))
(benchmark-run 1000000 (bench-seq-some l))) ;; (2.726298 19
0.7982190000000031)
(let ((l (list nil nil nil nil t)))
(benchmark-run 1000000 (bench-cl-loop-list l))) ;; (0.29131 0 0.0)
;; Big lists
(let ((l (make-list 10000000 nil)))
(benchmark-run 1 (bench-cl-some l))) ;; (0.142612 0 0.0)
(let ((l (make-list 10000000 nil)))
(benchmark-run 1 (bench-seq-some l))) ;; (0.379376 0 0.0)
(let ((l (make-list 10000000 nil)))
(benchmark-run 1 (bench-cl-loop-list l))) ;; (0.292876 0 0.0)
;; Small vectors
(let ((v (vector nil nil nil nil t)))
(benchmark-run 1000000 (bench-cl-some l))) ;; (4.058951 53
1.6585750000000008)
(let ((v (vector nil nil nil nil t)))
(benchmark-run 1000000 (bench-seq-some l))) ;; (2.61798 25
0.7980089999999986)
(let ((v (vector nil nil nil nil t)))
(benchmark-run 1000000 (bench-cl-loop-vec v))) ;; (0.306206 0 0.0)
;; Big vectors
(let ((v (make-vector 10000000 nil)))
(benchmark-run 1 (bench-cl-some v))) ;; (1.910587 14
1.2171730000000025) (DREADFUL, EASY TO FIX?)
(let ((v (make-vector 10000000 nil)))
(benchmark-run 1 (bench-seq-some v))) ;; (0.33895600000000004 0 0.0)
(let ((v (make-vector 10000000 nil)))
(benchmark-run 1 (bench-cl-loop-vec v))) ;; (0.325975 0 0.0)
)
next prev parent reply other threads:[~2023-11-07 10:24 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 8:21 What's missing in ELisp that makes, people want to use cl-lib? Pedro Andres Aranda Gutierrez
2023-11-03 9:27 ` João Távora
2023-11-03 10:43 ` Pedro Andres Aranda Gutierrez
2023-11-03 13:37 ` Gerd Möllmann
2023-11-03 14:27 ` Eli Zaretskii
2023-11-03 15:08 ` Gerd Möllmann
2023-11-03 15:13 ` Eli Zaretskii
2023-11-03 15:30 ` Gerd Möllmann
2023-11-03 15:39 ` Eli Zaretskii
2023-11-03 15:49 ` Gerd Möllmann
2023-11-06 2:27 ` seq.el and the complexity of Emacs Lisp Richard Stallman
2023-11-06 6:51 ` Philip Kaludercic
2023-11-06 7:16 ` Gerd Möllmann
2023-11-07 10:24 ` João Távora [this message]
2023-11-09 21:02 ` Jim Porter
2023-11-09 21:20 ` João Távora
2023-11-09 23:49 ` Jim Porter
2023-11-09 23:53 ` Jim Porter
2023-11-10 2:31 ` João Távora
2023-11-10 3:27 ` Jim Porter
2023-11-10 10:03 ` Alan Mackenzie
2023-11-10 12:01 ` Eli Zaretskii
2023-11-10 10:13 ` Michael Heerdegen
2023-11-10 10:26 ` João Távora
2023-11-10 13:30 ` Michael Heerdegen
2023-11-08 3:08 ` Richard Stallman
2023-11-08 5:31 ` Gerd Möllmann
2023-11-08 3:08 ` Richard Stallman
2023-11-06 8:11 ` Björn Bidar
2023-11-06 12:28 ` Eli Zaretskii
2023-11-06 21:43 ` Emanuel Berg
2023-11-07 5:21 ` tomas
2023-11-07 5:50 ` Emanuel Berg
2023-11-07 6:21 ` Emanuel Berg
2023-11-07 12:02 ` Ihor Radchenko
2023-11-07 12:28 ` Emanuel Berg
2023-11-07 12:20 ` Eli Zaretskii
2023-11-07 12:29 ` Emanuel Berg
2023-11-07 11:58 ` Eli Zaretskii
2023-11-07 12:26 ` Emanuel Berg
2023-11-08 3:08 ` Richard Stallman
[not found] ` <874jhz9u8z.fsf@>
2023-11-06 12:35 ` Eli Zaretskii
2023-11-06 12:50 ` Björn Bidar
2023-11-06 21:30 ` Emanuel Berg
2023-11-07 7:35 ` Harald Judt
2023-11-07 10:14 ` Emanuel Berg
2023-11-07 12:26 ` Harald Judt
2023-11-07 12:38 ` Ihor Radchenko
2023-11-07 12:58 ` Eli Zaretskii
2023-11-07 13:50 ` Emanuel Berg
2023-11-07 14:12 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALDnm53DHne6-oPAf0B8rHG7mwp-X7178FtKTiH8TAcAOg5Lig@mail.gmail.com \
--to=joaotavora@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=gerd.moellmann@gmail.com \
--cc=paaguti@gmail.com \
--cc=rms@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.