From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: seq.el and the complexity of Emacs Lisp. Date: Tue, 7 Nov 2023 10:24:36 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36287"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Richard Stallman , paaguti@gmail.com, emacs-devel@gnu.org To: =?UTF-8?Q?Gerd_M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 07 11:26:14 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r0JHh-0009Ex-QM for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Nov 2023 11:26:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0JGV-0006iU-Fc; Tue, 07 Nov 2023 05:24:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0JGT-0006Yc-6X for emacs-devel@gnu.org; Tue, 07 Nov 2023 05:24:57 -0500 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0JGN-0005LM-8n; Tue, 07 Nov 2023 05:24:56 -0500 Original-Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-507a0907896so6919615e87.2; Tue, 07 Nov 2023 02:24:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699352689; x=1699957489; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2roOY+pTp7ZojCthMMJgacEZSrFVFi+w1c3p7/2KS/Y=; b=ABUSIgAn9OLmUkpoIKaxsnu2ptyRHP2Wct4UxboXtux+ZJEwTA8UpjEdX9g5a+XbT+ vKL+v9ZY/cavoFmy076jR/VLh7pGyxbwLw7G7c/6ulxC2KK1SM+rF0LtKOxXkNOraNei QLst7vRsLcUcIs6EYMd3gNR4YMKt3Gb5pz2jtn/Rl/KpxgR5v/MO/A78kPlLqdKSn6lu +3up9ONLwF3i2J3Rt+sC7EDyhPA5tqm8KzzYijrisD/36jvWhaY9qU+dLak1+MkjvCLE txVn7V2NEprjquUtytVlB3X/+UqO+np/Ciz8wzu0dT74QYz7wGbbtyU9y8yTnK+7JQg0 ng/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699352689; x=1699957489; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2roOY+pTp7ZojCthMMJgacEZSrFVFi+w1c3p7/2KS/Y=; b=XqDQa+Ty7YGpY2AxQAYlsQUQUH49WN/lw4kKJ3lP+7TcOPOVcUTVX3t23uY5FMRhVs y2TLwt1MUSpiOuFlT1+F9qqr+dEJc1QA7XdcXHeJibvtFzwJVWTkjzbar8fZydSlMRfp VPS60Prz61E5No1jWy2IsvDH77AsxURkVY5nVNmoRYYTuIRM88Ls4ChjjSjHIheC1+bz VH7bhwHdntpfJ0dGFr6UdGUQlRt3+ojcX/ykFKl8X0HrPV/Dwk35XlBfn7PoQD5qcXyp 4TtgQNJaIhc38XCYj3Rrwx+mWdMDQottIQ/j3YuFPaTKKpMPWRS6XNjxzPavBlNR2c5J 9Sgg== X-Gm-Message-State: AOJu0YzyZ8JqJXvGUU5Y5wgOafAtRHEvQy/l1kg8xKYEzwH8DDZrOwp2 oWONz5IGjXgZ5OjoT4n1i1Ztmb9ETx+rCfL42JcBsZnjGkIX7w== X-Google-Smtp-Source: AGHT+IHIhoDiXEz4ljNieZZwP4L8H2aHqC6j5C6/ov943KAXKoF7jcizh8PUS1ghmYUMYN22Sys+o9I824kpgextArc= X-Received: by 2002:ac2:4846:0:b0:507:aaa4:e3b3 with SMTP id 6-20020ac24846000000b00507aaa4e3b3mr20927421lfy.50.1699352688376; Tue, 07 Nov 2023 02:24:48 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312291 Archived-At: On Mon, Nov 6, 2023 at 8:54=E2=80=AFAM Gerd M=C3=B6llmann wrote: > > Richard Stallman 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) )