unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kang Niu <isgniuk@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 52593@debbugs.gnu.org
Subject: bug#52593: 28.0.90; (thing-at-point thing) has so much overhead since commit 7db376e560448e61485ba054def8c82b21f33d6a
Date: Sun, 19 Dec 2021 23:37:05 +0800	[thread overview]
Message-ID: <CAOa1fPsqMq75CM2Ceq2wc8MvXy8AUiLOgnp-+RpmwE5tPa1H6w@mail.gmail.com> (raw)
In-Reply-To: <CAOa1fPsWo26WsOMiWb07x4z0aA6cv129Z4mHnAec4movaqqJ_A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2812 bytes --]

Maybe the field functions are slow.
I replaced the field functions with point-min and point-max
(narrow-to-region (point-min) (point-max))
and the overhead disappeared.

Kang Niu <isgniuk@gmail.com> 于2021年12月19日周日 23:19写道:

> Seems now the let clause undertake the overhead:
>      Samples    %   Function
>
>
>         7230  77% - symbol-overlay-post-command
>         7227  77%  - if
>         7183  77%   - string=
>         7180  77%    - symbol-overlay-get-symbol
>         7180  77%     - or
>         7176  77%      - thing-at-point
>         7163  77%       - save-restriction
>         7138  76%        - let
>          221   2%         - cond
>          206   2%          + let
>            2   0%            let*
>            7   0%         + if
>           40   0%   + symbol-overlay-remove-temp
>         1234  13% - command-execute
>         1215  13%  - call-interactively
>         1205  12%   - funcall-interactively
>          783   8%    + next-line
>          415   4%    + previous-line
>            7   0%    + execute-extended-command
>            3   0%   + byte-code
>          358   3% + ...
>          255   2% + redisplay_internal (C function)
>          156   1% + timer-event-handler
>           25   0% + undo-auto--add-boundary
>           18   0% + jit-lock--antiblink-post-command
>           17   0% + internal-timer-start-idle
>            8   0% + clear-minibuffer-message
>
> Lars Ingebrigtsen <larsi@gnus.org> 于2021年12月19日周日 22:44写道:
>
>> Kang Niu <isgniuk@gmail.com> writes:
>>
>> > There are no fields in the buffer. (field-beginning) (field-end) return
>> the same value
>> > as (point-min) (point-max).
>>
>> Odd.  Does the following fix the performance problem?  I'm wondering
>> whether it's the field functions that are slow or whether the
>> narrow-to-region is the thing that somehow triggers the slowness.
>>
>> diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
>> index 2d1bf2013e..e746d94080 100644
>> --- a/lisp/thingatpt.el
>> +++ b/lisp/thingatpt.el
>> @@ -178,7 +178,11 @@ thing-at-point
>>  See the file `thingatpt.el' for documentation on how to define
>>  a symbol as a valid THING."
>>    (save-restriction
>> -    (narrow-to-region (field-beginning) (field-end))
>> +    (let ((beg (field-beginning))
>> +          (end (field-end)))
>> +      (when (or (not (= beg (point-min)))
>> +                (not (= end (point-max))))
>> +        (narrow-to-region (field-beginning) (field-end))))
>>      (let ((text
>>             (cond
>>              ((cl-loop for (pthing . function) in
>> thing-at-point-provider-alist
>>
>>
>> --
>> (domestic pets only, the antidote for overdose, milk.)
>>    bloggy blog: http://lars.ingebrigtsen.no
>>
>

[-- Attachment #2: Type: text/html, Size: 4084 bytes --]

  reply	other threads:[~2021-12-19 15:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18  5:59 bug#52593: 28.0.90; (thing-at-point thing) has so much overhead since commit 7db376e560448e61485ba054def8c82b21f33d6a Kang Niu
2021-12-18  7:48 ` Eli Zaretskii
     [not found]   ` <CAOa1fPsPmyHpzyT8AUzkc4vFGCJXgWJ3NVjGg=99hF4b8AuaWQ@mail.gmail.com>
2021-12-19 13:26     ` Eli Zaretskii
2021-12-19 13:35       ` Lars Ingebrigtsen
2021-12-19 14:39         ` Kang Niu
2021-12-19 14:44           ` Lars Ingebrigtsen
2021-12-19 15:19             ` Kang Niu
2021-12-19 15:37               ` Kang Niu [this message]
2021-12-19 15:49                 ` Lars Ingebrigtsen
2021-12-19 15:55                   ` Lars Ingebrigtsen
2021-12-19 16:14                     ` Lars Ingebrigtsen
     [not found]                       ` <CAOa1fPuD=gVEF-SKtvuu4jkzu3p40xUBoejBjUrv-v0kDrc0qg@mail.gmail.com>
2021-12-20  9:24                         ` Lars Ingebrigtsen
2021-12-19 16:22       ` Lars Ingebrigtsen
2021-12-19 17:21         ` Lars Ingebrigtsen
2021-12-19 17:33           ` Lars Ingebrigtsen
2021-12-19 17:38             ` Eli Zaretskii
2021-12-20  9:23               ` Lars Ingebrigtsen
2021-12-20 17:23                 ` Eli Zaretskii
2021-12-21 11:03                   ` Lars Ingebrigtsen
2021-12-22  2:44       ` Kang Niu
2021-12-22 12:52         ` Lars Ingebrigtsen
2021-12-24 22:43           ` bug#52593: [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOa1fPsqMq75CM2Ceq2wc8MvXy8AUiLOgnp-+RpmwE5tPa1H6w@mail.gmail.com \
    --to=isgniuk@gmail.com \
    --cc=52593@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).