bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58558: 29.0.50; re-search-forward is slow in some buffers


From: Ihor Radchenko
Subject: bug#58558: 29.0.50; re-search-forward is slow in some buffers
Date: Tue, 13 Dec 2022 10:28:57 +0000

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I thought it might be easier to see the differences in results if one
> first attached perf to a fresh (fast) Emacs and got the trace, and the
> waited until Emacs got slow, and repeated the same thing under another
> trace.
>
> perf is able to do this by:
>
> perf record -p <PID> -g
>
> and
>
> perf report
>
> then shows me stuff, but I don't even know what to look for when
> interpreting that.  Or whether perf is, indeed, the right too for this
> task.

Ok. I got around to try perf, and it turned out to be very easy to get
started.

perf record -p <PID> + perf report already appear to give some clue:

    88.27%  emacs    emacs-30-vcs                      [.] 
buf_bytepos_to_charpos
     3.75%  emacs    emacs-30-vcs                      [.] re_match_2_internal
     1.35%  emacs    emacs-30-vcs                      [.] scan_sexps_forward
     1.03%  emacs    emacs-30-vcs                      [.] re_search_2
     0.65%  emacs    emacs-30-vcs                      [.] find_interval
     0.56%  emacs    emacs-30-vcs                      [.] sub_char_table_ref
     0.55%  emacs    emacs-30-vcs                      [.] lookup_char_property

The fraction of buf_bytepos_to_charpos increases over repeated benchmark
runs.

In contrast, using find-file-literally produces

    34.44%  emacs    emacs-30-vcs                             [.] 
re_match_2_internal
    25.55%  emacs    emacs-30-vcs                             [.] 
scan_sexps_forward
    11.09%  emacs    emacs-30-vcs                             [.] re_search_2
    ...
    0.59%  emacs    emacs-30-vcs                             [.] 
buf_bytepos_to_charpos

with buf_bytepos_to_charpos taking diminishing cpu sample fraction.

Any ideas what I can do further?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]