unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs Freezing With Java Files
@ 2023-02-10 23:42 Hank Greenburg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 3+ messages in thread
From: Hank Greenburg via Users list for the GNU Emacs text editor @ 2023-02-10 23:42 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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

I have a few Java files that are about 500 lines of code and I can't move around in them much before Emacs freezes. I first thought it was java-lsp but it still happened after disabling and uninstalling it. I also uninstalled lsp-mode as well, but that didn't change anything.

I started doing CPU profiles of it and found that which-function-mode was taking up 67% of my CPU usage. While this is happening all I was doing was holding the down arrow until it froze about 350 lines in. Didn't press any other buttons.

So I disabled which-function-mode and moved around the buffer just fine! Though when trying to edit the file (just hit enter), it froze again. This time it seems like electric-indent-mode was taking up close to 50% of my CPU usage.

I disabled that and tried again and then it froze again with c-indent-line-or-region eating up 63% of my CPU when I use TAB.

While using debug-on-quit I get the below output. Any idea what's happening here and how it can be addressed? I tried large files of other types and it only seems to happen with Java files. I attached screenshots of the CPU profiler outputs for each of the three scenarios.

I thought about submitting a bug report but I can't figure out what is fundamentally the cause here. I do know though that if I launch emacs with the -Q argument, then there aren't any problems at all.

Debugger entered--Lisp error: (quit)
beginning-of-defun()
c-get-fallback-scan-pos(17794)
c-parse-state-get-strategy(17794 1)
c-parse-state-1()
c-parse-state()
c-guess-basic-syntax()
c-indent-line()
#f(compiled-function () (interactive nil) #<bytecode 0x180248dcca1cc57e>)()
c-indent-command(nil)
c-indent-line-or-region(nil nil)
funcall-interactively(c-indent-line-or-region nil nil)
call-interactively(c-indent-line-or-region nil nil)
command-execute(c-indent-line-or-region)

[-- Attachment #2: emacs-freezing-cpu-profile-indent-mode-off.png --]
[-- Type: image/png, Size: 51786 bytes --]

[-- Attachment #3: emacs-freezing-cpu-profile.png --]
[-- Type: image/png, Size: 53977 bytes --]

[-- Attachment #4: emacs-freezing-cpu-profile-no-function-mode.png --]
[-- Type: image/png, Size: 103597 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Emacs Freezing With Java Files
@ 2023-02-11  0:26 Hank Greenburg via Users list for the GNU Emacs text editor
  2023-02-11  8:16 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Hank Greenburg via Users list for the GNU Emacs text editor @ 2023-02-11  0:26 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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

Sorry if this sent twice, I wasn't on the mailing list and didn't find it in the archives (which update every 15 minutes?).

I have a few Java files that are about 500 lines of code and I can't move around in them much before Emacs freezes. I first thought it was java-lsp but it still happened after disabling and uninstalling it. I also uninstalled lsp-mode as well, but that didn't change anything.

I started doing CPU profiles of it and found that which-function-mode was taking up 67% of my CPU usage. While this is happening all I was doing was holding the down arrow until it froze about 350 lines in. Didn't press any other buttons.

So I disabled which-function-mode and moved around the buffer just fine! Though when trying to edit the file (just hit enter), it froze again. This time it seems like electric-indent-mode was taking up close to 50% of my CPU usage.

I disabled that and tried again and then it froze again with c-indent-line-or-region eating up 63% of my CPU when I use TAB.

While using debug-on-quit I get the below output. Any idea what's happening here and how it can be addressed? I tried large files of other types and it only seems to happen with Java files. I attached screenshots of the CPU profiler outputs for each of the three scenarios.

I thought about submitting a bug report but I can't figure out what is fundamentally the cause here. I do know though that if I launch emacs with the -Q argument, then there aren't any problems at all.

I am using emacs version 28.2 on EndeavorOS.

Debugger entered--Lisp error: (quit)
beginning-of-defun()
c-get-fallback-scan-pos(17794)
c-parse-state-get-strategy(17794 1)
c-parse-state-1()
c-parse-state()
c-guess-basic-syntax()
c-indent-line()
#f(compiled-function () (interactive nil) #<bytecode 0x180248dcca1cc57e>)()
c-indent-command(nil)
c-indent-line-or-region(nil nil)
funcall-interactively(c-indent-line-or-region nil nil)
call-interactively(c-indent-line-or-region nil nil) command-execute(c-indent-line-or-region)

[-- Attachment #2: emacs-freezing-cpu-profile-indent-mode-off.png --]
[-- Type: image/png, Size: 51786 bytes --]

[-- Attachment #3: emacs-freezing-cpu-profile.png --]
[-- Type: image/png, Size: 53977 bytes --]

[-- Attachment #4: emacs-freezing-cpu-profile-no-function-mode.png --]
[-- Type: image/png, Size: 103597 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Emacs Freezing With Java Files
  2023-02-11  0:26 Emacs Freezing With Java Files Hank Greenburg via Users list for the GNU Emacs text editor
@ 2023-02-11  8:16 ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2023-02-11  8:16 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 11 Feb 2023 00:26:03 +0000
> From:  Hank Greenburg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> I have a few Java files that are about 500 lines of code and I can't move around in them much before Emacs freezes. I first thought it was java-lsp but it still happened after disabling and uninstalling it. I also uninstalled lsp-mode as well, but that didn't change anything.
> 
> I started doing CPU profiles of it and found that which-function-mode was taking up 67% of my CPU usage. While this is happening all I was doing was holding the down arrow until it froze about 350 lines in. Didn't press any other buttons.
> 
> So I disabled which-function-mode and moved around the buffer just fine! Though when trying to edit the file (just hit enter), it froze again. This time it seems like electric-indent-mode was taking up close to 50% of my CPU usage.
> 
> I disabled that and tried again and then it froze again with c-indent-line-or-region eating up 63% of my CPU when I use TAB.
> 
> While using debug-on-quit I get the below output. Any idea what's happening here and how it can be addressed? I tried large files of other types and it only seems to happen with Java files. I attached screenshots of the CPU profiler outputs for each of the three scenarios.
> 
> I thought about submitting a bug report but I can't figure out what is fundamentally the cause here. I do know though that if I launch emacs with the -Q argument, then there aren't any problems at all.

Please do submit a bug report for this.

Include in the bug report at least one of the files that cause this
issue, and the profiles you collected

If "emacs -Q" doesn't reproduce the problem, please try to come up
with the minimal set of customizations from your init files which does
cause the problem, and post that as well.

In general, only reporting problems with all the details as bugs
guarantee that the Emacs maintainers will investigate the problem and
try to fix it.

> I am using emacs version 28.2 on EndeavorOS.

Would it be possible for you to build the emacs-29 branch of the Emacs
Git repository, and see if the problem exists there as well?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-11  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-11  0:26 Emacs Freezing With Java Files Hank Greenburg via Users list for the GNU Emacs text editor
2023-02-11  8:16 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2023-02-10 23:42 Hank Greenburg via Users list for the GNU Emacs text editor

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).