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 14:40:27 +0000 Message-ID: References: <320999cc-6c83-2315-0044-cc0403400af3@gutov.dev> <9ab5d2bd-a648-cae0-a4a7-ae86be10af0f@gutov.dev> <87r0kuqxbf.fsf@gmail.com> <54e115a2-fc36-3056-a030-0dbf32416ddb@gutov.dev> <43f290b0-4119-597b-c89a-0fb4c7db1665@gutov.dev> <1e7fe1ef-af7d-3222-7b9e-b569b3c97ccf@gutov.dev> <22e4cb4d-a8f3-1530-881d-b8c59c5d969b@gutov.dev> <87h6lln86l.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d47173060a45f555" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14660"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 16 15:37:52 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 1r3dV9-0003gc-QX for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Nov 2023 15:37:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3dUx-0007a4-J9; Thu, 16 Nov 2023 09:37:39 -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 1r3dUv-0007YS-JD for emacs-devel@gnu.org; Thu, 16 Nov 2023 09:37:37 -0500 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3dUt-0008FU-Tg for emacs-devel@gnu.org; Thu, 16 Nov 2023 09:37:37 -0500 Original-Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50a6ff9881fso1291905e87.1 for ; Thu, 16 Nov 2023 06:37:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700145454; x=1700750254; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=oL4WVoM/hTW2bubtDk+RktmSoN4ipwyOpX0KKdJUm2c=; b=Vu4Jepq5UFlD/AVgMZaw/RtfPLleuczaGq0AL1fSRBsJJ2+7o0JJiWlvz22grrEv8a 6o2mn7U5sRUJyo/wLVqxBFSj66a0PFp2R10gjEwnK5db5YoTjcOwUIIww5lUymSxy8VF Vr6GeGMaFgiyMctdWV9PnquR4WOaQ4PqKeVV1wsUb7FLcCxdHDmW+qgsfG7M7o5QXFmq pr1Q0U0Pv5n6KJ47DFmFphFB537lYZDh738+pfICUDRrpG/I0+wPik7m1Rz1yKrBfDIU Fd6p0k4mrC7nYQycIvYHVyT9yb4I0YfnVeh/1gqNYAn4zKq1ZRAga+pZO5fnpkHph8al uhsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700145454; x=1700750254; h=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=oL4WVoM/hTW2bubtDk+RktmSoN4ipwyOpX0KKdJUm2c=; b=BzBnMNSb+8xHUGGTYMAFwhzduYS+c+JT4pNR/eYEJ4C0Koax9WkoHFuwT+zLiXBRS7 0miSGL7VbSzQNlqRBrSKaDeVacV2/nmvBqxkxFSu6ZAHRQGco28xJHzs8bOBq1BhQg/Y gZxYZMPSP98NAr310pgslwr5HUBqrsFCaMv1uMzJqKZZJ1NjU1+iXpXtYxjh/zFlpoFh xWddySH6/ecnEhdqjtWwZlHFlzvVKy/sBsFKf2ChJg/VTzIBaa4lB8qMF9hLJ+8tCpVM CYybXjoYKGLXe7foBDE3FKEscxGkNko0vk1lIo+zR79hxa0otx/owQcQbRIklJxsl1xh 5ypA== X-Gm-Message-State: AOJu0YwDd0SdkI+ZY1w3l+xD4pT+Lg4w7qafuDPMI88e+n2qmWguk0fL KMNNhfoj0sqw4dRgLp6sv8zVOee0RqQ8G8ooFm0= X-Google-Smtp-Source: AGHT+IFpdCnxI6VPRYoYh/hVYm/1j5vT0jDXkQ9WRUfj2t86NkhkYxhnLvdJylvTVoyU1Pmbjw0lzS+xpFVbKWFyl4Q= X-Received: by 2002:a19:8c10:0:b0:50a:9652:31d4 with SMTP id o16-20020a198c10000000b0050a965231d4mr4218237lfd.22.1700145453624; Thu, 16 Nov 2023 06:37:33 -0800 (PST) In-Reply-To: <87h6lln86l.fsf@web.de> Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x133.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, HTML_MESSAGE=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:312798 Archived-At: --000000000000d47173060a45f555 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Nov 16, 2023 at 1:23=E2=80=AFPM Michael Heerdegen wrote: > Jo=C3=A3o T=C3=A1vora writes: > > > The only way you are eventually going to get to equal performance > > with cl-lib's fastest variants (but only the non-destructive, of course= ) > > is if you start every seq.el entry point with sth like > > > > (if (sequence-p seq) (call-equivalent-cl-lib-version seq) ...) > > > > But then I don't see how that fits in with the cl-defgeneric, > > which does dispatching before that if. The only way I see this > > is to invent a new kind of specializer in cl-generic.el like > > 'definitely-not-sequence'. There could be some other solution, > > maybe Michael as a clue. > > I'm a bit lost I must admit. I don't understand the use of your > `sequence-p' test (all we use seq.el for are sequences...?). Yes, but custom sequences don't respond t to sequencep. It is a C built-in that only returns t for lists and arrays and strings. And those are the types that the sequence functions in cl-lib.el works with, and why it is faster than seq.el, because it only dispatches between them with ifs. If seq.el wants to be just as fast, it must to that much simpler kind of dispatch, and this has of course has implications for its generic function interface. Jo=C3=A3o --000000000000d47173060a45f555 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Thu, Nov 16, 2023 at 1:23=E2=80=AFPM Michael Heerdegen <michael_heerdegen@web.de> = wrote:
Jo=C3=A3o= T=C3=A1vora <= joaotavora@gmail.com> writes:

> The only way you are eventually going to get to equal performance
> with cl-lib's fastest variants (but only the non-destructive, of c= ourse)
> is if you start every seq.el entry point with sth like
>
>=C2=A0 =C2=A0 (if (sequence-p seq) (call-equivalent-cl-lib-version seq)= ...)
>
> But then I don't see how that fits in with the cl-defgeneric,
> which does dispatching before that if.=C2=A0 The only way I see this > is to invent a new kind of specializer in cl-generic.el like
> 'definitely-not-sequence'.=C2=A0 There could be some other sol= ution,
> maybe Michael as a clue.

I'm a bit lost I must admit.=C2=A0 I don't understand the use of yo= ur
`sequence-p' test (all we use seq.el for are sequences...?).

Yes, but custom sequences don't respond t to sequ= encep.=C2=A0 It is a=C2=A0
C built-in that only returns t for lis= ts and arrays and strings.
And those are the types that the seque= nce functions in cl-lib.el
works with, and why it is faster than = seq.el, because it only=C2=A0
dispatches between them with ifs.= =C2=A0 If seq.el wants to be just
as fast, it must to that much s= impler kind of dispatch, and
this has of course has implications = for its generic function
interface.

Jo= =C3=A3o

=C2=A0
--000000000000d47173060a45f555--