From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kang Niu Newsgroups: gmane.emacs.bugs Subject: bug#52593: 28.0.90; (thing-at-point thing) has so much overhead since commit 7db376e560448e61485ba054def8c82b21f33d6a Date: Wed, 22 Dec 2021 10:44:27 +0800 Message-ID: References: <83zgoybbfr.fsf@gnu.org> <83ee689156.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000065e6ef05d3b31a7f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21547"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52593@debbugs.gnu.org To: Eli Zaretskii , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 22 03:45:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1mzrcs-0005S6-5d for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Dec 2021 03:45:10 +0100 Original-Received: from localhost ([::1]:46216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzrcq-0002U3-Cy for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Dec 2021 21:45:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzrck-0002Tv-7Q for bug-gnu-emacs@gnu.org; Tue, 21 Dec 2021 21:45:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzrcj-0005Zk-UH for bug-gnu-emacs@gnu.org; Tue, 21 Dec 2021 21:45:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mzrcj-0001VF-MX for bug-gnu-emacs@gnu.org; Tue, 21 Dec 2021 21:45:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kang Niu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Dec 2021 02:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52593 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch moreinfo Original-Received: via spool by 52593-submit@debbugs.gnu.org id=B52593.16401410895745 (code B ref 52593); Wed, 22 Dec 2021 02:45:01 +0000 Original-Received: (at 52593) by debbugs.gnu.org; 22 Dec 2021 02:44:49 +0000 Original-Received: from localhost ([127.0.0.1]:56333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mzrcX-0001Ub-Ci for submit@debbugs.gnu.org; Tue, 21 Dec 2021 21:44:49 -0500 Original-Received: from mail-yb1-f170.google.com ([209.85.219.170]:34322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mzrcS-0001UE-IN for 52593@debbugs.gnu.org; Tue, 21 Dec 2021 21:44:47 -0500 Original-Received: by mail-yb1-f170.google.com with SMTP id y68so2179135ybe.1 for <52593@debbugs.gnu.org>; Tue, 21 Dec 2021 18:44:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I2paCL30w1TvgZuBun5KUTlT9xuc8GMgIQGUrlOf0MI=; b=SaLqaQPc6et+qkK2/sig/U2CZ9bls3Wi0s6MaEn4hVjjPfCIMUOU1pRIAf3/7+jaBF 7BsoO/rfG+L1XK6KmiaQ8QRKWTtsnc4LWD1ZTUdjTpTLZqjTu1n/on9KByvJM8yk/bcw j6jcu+WpiRCRMPlAHRIwuYQa/U3URiE8PgcHu9OgNtC7a2QfgWcT/Sx10v660q+Cqneh rKd63cXsMAnj7kCtIdIWlyY7eYe4C+m6PKEFAzjvnawiz4N7oH0arBk98/RnXF+qjCOz znHzYWCuth2sEq4QynCQuOURBleb8Q5G2GXHtNvHm6lfYPqxA1NcHqR/p3uMREt5uz+M 9wWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I2paCL30w1TvgZuBun5KUTlT9xuc8GMgIQGUrlOf0MI=; b=FhVoE/F9PH3+rDA0Xfqt1o1VxAPeEGUcUQqLLIz3UR/uoJ4Mw+uB3sGiLZBw0EapnG MxQbMz2z5gn7CaSEPIaIqXmQOuF+ekMTgvwqnqNBeyBFqHS/o2eanXwdUsZEXSGXJ8RS nMDpGjIpS2bdQH7QbVhjK/9lPgG47HBjU8hCr3rgO0PQuWLY6M6s8t8DGcq3EJhvIsnp bwVmUcdE2r65iS3q3tU6sOZ34w76pnHRdHJQv3rQU5cLp+CwyfMVDlcgGH9NJJFf8Yut wK0e6W5ooJNbaaLW/pzXfPZY9nMqAv9341xqYCqOp+PZNMJI1klyfcqbxdZQLhETNmLI KLqA== X-Gm-Message-State: AOAM5339pM/wZt/NZ4U5tssNF+3p6XkwSTdjL/UX48n8FRT5gnutcw0l 4bChawrEEPAZlL06lhU9C+FnxO93Ox0/BYQmkCQ= X-Google-Smtp-Source: ABdhPJy0oEnd/W6FKxi/0TSnwf2NdoQ/nHcOxAERbXcHIU6cxx+kKbXKZx9e2G89PDu7IbZYUpBN5HK+1N7jhl+O1A0= X-Received: by 2002:a25:2e45:: with SMTP id b5mr1631679ybn.125.1640141079043; Tue, 21 Dec 2021 18:44:39 -0800 (PST) In-Reply-To: <83ee689156.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222906 Archived-At: --00000000000065e6ef05d3b31a7f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Maybe an optional arg for thing-at-point is necessary to respect fields? As I understand, it should be determined by the user of thing-at-point to get what kind of thing at point. If the user knows or expects fields in the text, he passes the optional arg= . If the user just wants the "normal" thing at the point whether there are fields or not, he calls it without the opt arg as the old way. Eli Zaretskii =E4=BA=8E2021=E5=B9=B412=E6=9C=8819=E6=97=A5= =E5=91=A8=E6=97=A5 21:26=E5=86=99=E9=81=93=EF=BC=9A > [Forwarding to the bug tracker. Please use Reply All to keep the bug > tracker on the CC list.] > > > From: Kang Niu > > Date: Sun, 19 Dec 2021 21:07:24 +0800 > > > > Thanks for your reply. I'v added two lines of code at the beginning of > narrow-to-region and made a test. > > > > 2681 EMACS_INT s =3D fix_position (start), e =3D fix_position (end); > > 2682 if (BEGV =3D=3D s && ZV =3D=3D e) > > 2683 return Qnil; > > > > The overhead was still there with little improvement. > > That is very strange, since the code is almost a no-op. > > Does field-beginning and field-end indeed return BOB and EOB in that > case? Maybe field-beginning and field-end take this time? > > > The overhead disappears only if I comment out (narrow-to-region > (field-beginning) (field-end)) in > > thing-at-point. > > Perhaps thing-at-point should acquire a new optional argument saying >> "don't pay attention to fields"? > > > > It is unnoticed but with some modes that call thing-at-point in > post-command-hook, it's unbearable. > > > > OS: > > ArchLinux with gcc-11.1.0 > > & > > Ubuntu16.04 with gcc-9 > > > > configuration: > > ./configuration 'CFLAGS=3D-O2 -pipe' --prefix=3D/usr --libdir=3D/usr/li= b > --sysconfdir=3D/etc --libexecdir=3D/usr/lib > > --localstatedir=3D/var --without-x --with-x-toolkit=3Dno --without-xwid= gets > --without-toolkit\ > > -scroll-bars --without-dbus --without-gsettings --without-gconf > --without-xim --without-xpm --without-jpeg > > --without-tiff --without-gif --without-png --without-rsvg > --without-imagem\ > > agick --without-lcms2 --without-libsystemd --without-selinux > --without-xaw3d --without-gpm --with-sound=3Dno > > --without-xft --without-libotf --without-cairo --without-harfbuzz > --withou\ > > t-m17n-flt --with-modules --without-compress-install > --00000000000065e6ef05d3b31a7f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Maybe an optional arg for thing-at-point is necessary= to respect fields?
As I understand, it should be determined by t= he user of thing-at-point to get what kind of thing at point.
If = the user knows or expects fields in the text, he passes the optional arg.
If the user just wants the "normal" thing at the point w= hether there are fields or not, he calls it without the opt arg as the old = way.

Eli Zaretskii <eliz@gnu.org> = =E4=BA=8E2021=E5=B9=B412=E6=9C=8819=E6=97=A5=E5=91=A8=E6=97=A5 21:26=E5=86= =99=E9=81=93=EF=BC=9A
[Forwarding to the bug tracker.=C2=A0 Please use Reply All to keep th= e bug
tracker on the CC list.]

> From: Kang Niu <isgniuk@gmail.com>
> Date: Sun, 19 Dec 2021 21:07:24 +0800
>
> Thanks for your reply. I'v added two lines of code at the beginnin= g of narrow-to-region and made a test.
>
> 2681=C2=A0 =C2=A0EMACS_INT s =3D fix_position (start), e =3D fix_posit= ion (end);
> 2682=C2=A0 =C2=A0if (BEGV =3D=3D s && ZV =3D=3D e)
> 2683=C2=A0 =C2=A0 =C2=A0return Qnil;
>
> The overhead was still there with little improvement.

That is very strange, since the code is almost a no-op.

Does field-beginning and field-end indeed return BOB and EOB in that
case?=C2=A0 Maybe field-beginning and field-end take this time?

> The overhead disappears only if I comment out (narrow-to-region (field= -beginning) (field-end)) in
> thing-at-point.

Perhaps thing-at-point should acquire a new optional argument saying
"don't pay attention to fields"?

> It is unnoticed but with some modes that call thing-at-point in post-c= ommand-hook, it's unbearable.
>
> OS:
> ArchLinux with gcc-11.1.0
> &
> Ubuntu16.04 with gcc-9
>
> configuration:
> ./configuration 'CFLAGS=3D-O2 -pipe' --prefix=3D/usr --libdir= =3D/usr/lib --sysconfdir=3D/etc --libexecdir=3D/usr/lib
> --localstatedir=3D/var --without-x --with-x-toolkit=3Dno --without-xwi= dgets --without-toolkit\
> -scroll-bars --without-dbus --without-gsettings --without-gconf --with= out-xim --without-xpm --without-jpeg
> --without-tiff --without-gif --without-png --without-rsvg --without-im= agem\
> agick --without-lcms2 --without-libsystemd --without-selinux --without= -xaw3d --without-gpm --with-sound=3Dno
> --without-xft --without-libotf --without-cairo --without-harfbuzz --wi= thou\
> t-m17n-flt --with-modules --without-compress-install
--00000000000065e6ef05d3b31a7f--