GNU bug report logs -
#51631
29.0.50; cc-mode fontification makes CPU at 100%
Previous Next
Reported by: Zhiwei Chen <condy0919 <at> gmail.com>
Date: Sat, 6 Nov 2021 11:03:02 UTC
Severity: normal
Tags: confirmed, moreinfo
Merged with 51692
Found in version 29.0.50
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51631 in the body.
You can then email your comments to 51631 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51631
; Package
emacs
.
(Sat, 06 Nov 2021 11:03:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Zhiwei Chen <condy0919 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 06 Nov 2021 11:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
of 2021-11-06 built on lilydjwg
Repository revision: 5a013838746c160cb296e0bc80a11795d2538f9a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Arch Linux
It's originally reported at emacs-china.org [1].
emacs -Q, then open the following c++ snippet.
#+begin_src C++
#include <iostream>
#include <vector>
#define MAX 10000
void merge(std::vector<int> array, int p, int q, int r) {
int len_1 = q - p + 1;
int len_2 = r - q;
int a = 0;
int b = 0;
std::vector<int> left_array(len_1 + 2, 0);
std::vector<int> right_array(len_2 + 2, 0);
for (int i = 0; i < len_1; ++i) {
left_array[i] = array[p + i - 1];
}
for (int i = 0; i < len_2; ++i) {
right_array[i] = array[q + i];
}
left_array[len_1 + 1] = MAX;
right_array[len_2 + 1] = MAX;
for (int i = p; i < r + 1; ++i) {
if (left_array[a] <= right_array[b]) {
array[i] = left_array[a];
++a;
} else {
array[i] = right_array[b];
++b;
}
}
}
void merge_sort(std::vector<int> array, int p, int r) {
if (p < r) {
int q = (p + r) / 2;
merge_sort(array, p, q);
merge_sort(array, q + 1, r);
merge(array, p, q, r);
}
}
int main() {
std::vector<int> array = {3, 1, 2, 6, 4, 5};
merge_sort(array, 0, array.size() - 1);
for (auto i : array) {
std::cout << i << "\n";
}
return 0;
}
#+end_src
The profiler shows `jit-lock-function' costs 62% CPU time.
#+begin_src text
2952 62% - redisplay_internal (C function)
2936 62% - jit-lock-function
2936 62% - jit-lock-fontify-now
2920 62% - jit-lock--run-functions
2920 62% - run-hook-wrapped
2920 62% - #<compiled 0x19b62a583670403d>
2920 62% - font-lock-fontify-region
2920 62% - c-font-lock-fontify-region
2605 55% - font-lock-default-fontify-region
2534 53% - font-lock-fontify-keywords-region
1339 28% - c-font-lock-declarations
1317 27% - c-find-decl-spots
593 12% + #<compiled 0x62f8c10afa44432>
582 12% + c-bs-at-toplevel-p
#+end_src
[1]: https://emacs-china.org/t/emacs-c/18814
--
Zhiwei Chen
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51631
; Package
emacs
.
(Sat, 06 Nov 2021 18:37:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 51631 <at> debbugs.gnu.org (full text, mbox):
Zhiwei Chen <condy0919 <at> gmail.com> writes:
> emacs -Q, then open the following c++ snippet.
I put the snippet into a file /tmp/snippet.cc, and said:
./src/emacs -Q /tmp/snippet.cc
But I was unable to reproduce the problem -- the file displayed as
normal for me, and Emacs didn't use 100% CPU.
Are there any additional steps necessary to reproduce the problem?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 06 Nov 2021 18:37:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51631
; Package
emacs
.
(Sun, 07 Nov 2021 01:56:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 51631 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Zhiwei Chen <condy0919 <at> gmail.com> writes:
>
>> emacs -Q, then open the following c++ snippet.
>
> I put the snippet into a file /tmp/snippet.cc, and said:
>
> ./src/emacs -Q /tmp/snippet.cc
>
> But I was unable to reproduce the problem -- the file displayed as
> normal for me, and Emacs didn't use 100% CPU.
>
> Are there any additional steps necessary to reproduce the problem?
Keeping pressing C-p/C-n will see the noticeable latency. To be
specific, C-p/C-n in the merge function makes Emacs unresponsive.
--
Zhiwei Chen
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51631
; Package
emacs
.
(Sun, 07 Nov 2021 02:09:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 51631 <at> debbugs.gnu.org (full text, mbox):
Zhiwei Chen <condy0919 <at> gmail.com> writes:
> Keeping pressing C-p/C-n will see the noticeable latency. To be
> specific, C-p/C-n in the merge function makes Emacs unresponsive.
Ah, yes -- point movement inside the merge function takes a noticeable
amount of time.
I've added Alan to the CCs.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Merged 51631 51692.
Request was from
Alan Mackenzie <acm <at> muc.de>
to
control <at> debbugs.gnu.org
.
(Thu, 11 Nov 2021 19:07:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 11 Dec 2021 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 98 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.