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: What's missing in ELisp that makes people want to use cl-lib? Date: Thu, 16 Nov 2023 00:28:11 +0000 Message-ID: References: <87bkc4jpja.fsf@dataswamp.org> <12da6bcb-1818-7fbe-12af-8d4607724332@gutov.dev> <87il6bt4z0.fsf@yahoo.com> <8734xetjkk.fsf@yahoo.com> <87cywhsrcf.fsf@yahoo.com> <87cywgx1z0.fsf@web.de> <83wmuowwp3.fsf@gnu.org> <87fs172i62.fsf@gmail.com> <87y1ey1zn9.fsf@gmail.com> 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="40385"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Michael Heerdegen , emacs-devel@gnu.org To: Augusto Stoffel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 16 01:29:24 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 1r3QG4-000AO3-9U for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Nov 2023 01:29:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3QFE-0004ld-VI; Wed, 15 Nov 2023 19:28:32 -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 1r3QFC-0004lC-2X for emacs-devel@gnu.org; Wed, 15 Nov 2023 19:28:30 -0500 Original-Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3QFA-00022u-C6; Wed, 15 Nov 2023 19:28:29 -0500 Original-Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-507973f3b65so317164e87.3; Wed, 15 Nov 2023 16:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700094504; x=1700699304; 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=oniU/q/2ZwemWm10eFYmCdf6aLAR82fiIALTcZz149w=; b=bVH7lYZTrD3t5GCLS/Ae2k9ODyw8jcHxQ1Rm3ERRxGIofh5ZGTge5l1CIbNgivkDNh wBCLxrtN7H/79uXzJ1K3dHeABx5x+kZlFy1YsOuiU+YaKC9TAIm1ev/uJinoTFqp+LxN pXI2+Vcx3EJAm9nrghiFLnJ+xhLIBe6wlTSy4jN7XlHCIXrNVp/IThl+0suRVeHsMcuq 3jlQrhI816JCuQ9cKrIubirwKx81uKxL8AY2MWNw7FS+IiO7ru7g7Wjhq2+ppPIRa9CY J8utocQJc3rqW3YEHDDawlPeg6mdmeaE82Dn6N+CMeoDKX6ojqQ0nSgQyAOfzCAPsVtK Uw6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700094504; x=1700699304; 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=oniU/q/2ZwemWm10eFYmCdf6aLAR82fiIALTcZz149w=; b=no04/TaxaYisVbLlOaVjaRoJDnY6XrvBenQwH0R3c5yIDoQba0Zc5DV7KST7UeNaX3 S8RuC+vTM05xIQQGQyO8QEzHh6QbIxfLrZkFjrplgfAgeebZr4ZlZwR8Qh5UxS5/xmlA wtvG0SUNd5vjdIQxEudcvOprYdUjCgK3dBpvwjB1cAGY2kBz7qdduqAQMxqyu41kdfnw 3r8FMJjQCn2MYRXASeuHSZTWg/2QZv700MQB06oP8RRoB71KTSKY+/7uUB9fE/fy6IlT dOKnt/Z7xSM83Ox3JEv8aZxHTDJjyxrJQ++DPoQVqMLOXzO+UG0z+tbbbWNOF8glRQ8J 0e2Q== X-Gm-Message-State: AOJu0YyiZN3VyS2Y/STAxLMXp4bLWhIHooSgefhlNa32iaHPGmlm7S44 s4VpXR0A3Nwm7A8leVL4jsGB9pvrWFbgCYh4Y3s= X-Google-Smtp-Source: AGHT+IGvGpMwCf9iOeVEGHt7Wt2wbcvA8J4pEQwCM5A80ac6x9Q+wI7XP/sGtc+vrDIsRGg33ButkIVm+smuW7oGBzk= X-Received: by 2002:a05:6512:2805:b0:509:8deb:9cf5 with SMTP id cf5-20020a056512280500b005098deb9cf5mr12203319lfb.0.1700094503548; Wed, 15 Nov 2023 16:28:23 -0800 (PST) In-Reply-To: <87y1ey1zn9.fsf@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x12e.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:312775 Archived-At: On Wed, Nov 15, 2023 at 9:21=E2=80=AFPM Augusto Stoffel wrote: > > On Wed, 15 Nov 2023 at 14:51, Jo=C3=A3o T=C3=A1vora 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)) I don't think you just skip the seq-do generic like that :-) That breaks any sequence type based on lists. This is exactly the problem I was raising with too-many-generic interfaces, btw. Try Dmitry's patch instead, the one containing seq-difference-3. That's more consequential (but still not fully consequential, though, also breaks things). > 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) > ) Did you try my feature/cl-lib-improvements branch? Give cl-nset-difference a try there. > > 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. Are you familiar with the cl-lib.el "aesthetics"? The simple versions argumentless versions are no uglier than seq's, cl-some vs seq-some cl-every vs set-every-p cl-set-difference vs seq-intersection What specific thing do you like in seq.el that you don't find in the sequence functions of cl-lib.el? Jo=C3=A3o