[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What's missing in ELisp that makes people want to use cl-lib?
From: |
Augusto Stoffel |
Subject: |
Re: What's missing in ELisp that makes people want to use cl-lib? |
Date: |
Wed, 15 Nov 2023 22:21:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Wed, 15 Nov 2023 at 14:51, João Távora wrote:
> That and the fact they aren't aware they're anywhere from 5x to
> 10x slower, sometimes more (I measured 18x for decently realistic),
> than what they could be.
seq can surely be optimized, and I'm skeptical the issue lies in the
generic method dispatch (which would be a fundamental problem). It
seems more likely due to the fact that the default implementations wrap
predicate functions and macro bodies into lambdas.
I tried one of the your benchmarks, with results consistent with yours:
(setq cc (all-completions "" obarray))
(setq list2 (make-list 12 "shooveedoowaa"))
(when nil
(benchmark-run 100 (cl-set-difference cc list2 :test #'equal))
;(11.517403284999999 45 4.082223424999995)
(benchmark-run 100 (seq-difference cc list2))
;(18.507667340999998 119 10.999239876000019)
)
Then I tried the first optimization that comes to mind, which is to
redefine seq-doseq as
(defmacro seq-doseq (spec &rest body)
"Loop over a SEQUENCE, evaluating BODY with VAR bound to each of its
elements.
Similar to `dolist' but can be applied to lists, strings, and vectors.
\(fn (VAR SEQUENCE) BODY...)"
(declare (indent 1) (debug ((symbolp form &optional form) body)))
`(let ((var1234 ,(cadr spec)))
(cond
((listp var1234)
(dolist ,spec ,@body))
(t
(seq-do (lambda (,(car spec))
,@body)
var1234)))))
And now I get:
(when nil
(benchmark-run 100 (cl-set-difference cc list2 :test #'equal))
;(11.517403284999999 45 4.082223424999995)
(benchmark-run 100 (seq-difference cc list2))
;(7.308574982 29 2.6960850209999876)
)
> Also the fact they don't know cl-seq.el provides all that with
> a much more versatile interface, and frequently much better
> performance.
I for one like the simple aesthetics of seq.
- Re: What's missing in ELisp that makes people want to use cl-lib?, (continued)
- Re: What's missing in ELisp that makes people want to use cl-lib?, T.V Raman, 2023/11/15
- Re: What's missing in ELisp that makes people want to use cl-lib?, Michael Heerdegen, 2023/11/12
- RE: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?, Drew Adams, 2023/11/12
- Re: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?, João Távora, 2023/11/12
- RE: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?, Drew Adams, 2023/11/12
- Re: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?, João Távora, 2023/11/12
- RE: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?, Drew Adams, 2023/11/12
- Re: What's missing in ELisp that makes people want to use cl-lib?, Emanuel Berg, 2023/11/12
- Re: What's missing in ELisp that makes people want to use cl-lib?, Augusto Stoffel, 2023/11/15
- Re: What's missing in ELisp that makes people want to use cl-lib?, João Távora, 2023/11/15
- Re: What's missing in ELisp that makes people want to use cl-lib?,
Augusto Stoffel <=
- Re: What's missing in ELisp that makes people want to use cl-lib?, João Távora, 2023/11/15
- Re: What's missing in ELisp that makes people want to use cl-lib?, Augusto Stoffel, 2023/11/16
- Re: What's missing in ELisp that makes people want to use cl-lib?, João Távora, 2023/11/16
- Re: What's missing in ELisp that makes people want to use cl-lib?, Dmitry Gutov, 2023/11/16
- Re: What's missing in ELisp that makes people want to use cl-lib?, João Távora, 2023/11/16
- Re: What's missing in ELisp that makes people want to use cl-lib?, Emanuel Berg, 2023/11/11
- Re: What's missing in ELisp that makes people want to use cl-lib?, Eli Zaretskii, 2023/11/11
- Re: What's missing in ELisp that makes people want to use cl-lib?, Emanuel Berg, 2023/11/11
- Re: What's missing in ELisp that makes people want to use cl-lib?, Eli Zaretskii, 2023/11/11
- RE: [External] : Re: What's missing in ELisp that makes people want to use cl-lib?, Drew Adams, 2023/11/11