emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* emacs really slow when inserting a new source code block
@ 2022-09-25 17:35 Luca Ferrari
  2022-09-26  4:42 ` Ihor Radchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-25 17:35 UTC (permalink / raw)
  To: emacs-org list

Hi all,
I'm having issues in my org files whenever I insert a new source block
(perl if that matters) with "#+begin_src perl" Emacs becomes really
slow.
I can move, paste, edit within the source block (in the same org
buffer, not an external window) but at a very slow rate.
In the messages I've only this:

Starting new Ispell process aspell with default dictionary...done
Error enabling Flyspell mode:
(No Ispell process to read output from!)

This puzzles me because the language of my org document is set to
"it", but I never found such a big problem before.
I've tried other type of source blocks, and while they appear to
behave smoothier, whenever I edit "#+end_src" Emacs has a freeze, and
in fact in the screen I see only "#+end_s" and after a second the line
completes.

I'm running GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0) with org-mode 9.5.5.

Anything I can inspect?

Thanks,
Luca


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

* Re: emacs really slow when inserting a new source code block
  2022-09-25 17:35 emacs really slow when inserting a new source code block Luca Ferrari
@ 2022-09-26  4:42 ` Ihor Radchenko
  2022-09-26 15:07   ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2022-09-26  4:42 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

> Hi all,
> I'm having issues in my org files whenever I insert a new source block
> (perl if that matters) with "#+begin_src perl" Emacs becomes really
> slow.
> I can move, paste, edit within the source block (in the same org
> buffer, not an external window) but at a very slow rate.
> In the messages I've only this:

Thanks for reporting!
May you
1. M-x profiler-start <RET> cpu <RET>
2. Move/paste/edit your source block
3. M-x profiler-report <RET>
4. M-x profiler-report-write-profile and share the resulting file here
?

> Starting new Ispell process aspell with default dictionary...done
> Error enabling Flyspell mode:
> (No Ispell process to read output from!)

Did you try disabling flyspell?

-- 
Ihor Radchenko,
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


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

* Re: emacs really slow when inserting a new source code block
  2022-09-26  4:42 ` Ihor Radchenko
@ 2022-09-26 15:07   ` Luca Ferrari
  2022-09-26 15:17     ` Ihor Radchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-26 15:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Mon, Sep 26, 2022 at 6:41 AM Ihor Radchenko <yantar92@gmail.com> wrote:
> Thanks for reporting!
> May you
> 1. M-x profiler-start <RET> cpu <RET>
> 2. Move/paste/edit your source block
> 3. M-x profiler-report <RET>
> 4. M-x profiler-report-write-profile and share the resulting file here

Apparently I'm not able to get the profiler report written.
However, I discovered that, for instance, when I'm editing a piece of
code with regexp Emacs seems to suffer, at least it is the only
chances I had today to get it slower.
The messages buffer does not help very much:

CPU and memory profiler started
End of ‘m/ ... /’ string/RE not found: (scan-error Unbalanced parentheses 74 82)
Auto-saving...done
CPU and memory profiler stopped
profiler-write-profile: Wrong type argument: arrayp, nil

As you can see, I cannot save the profiler report, neither by placing
a filename, nor leaving it to save in the current directory of the
file I'm editing.

Oh, I also tried to disable flyspell, but it seems to me it gets
re-enabled for the source code block I'm within (but it's just a
feeling).

Any idea?

Luca


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

* Re: emacs really slow when inserting a new source code block
  2022-09-26 15:07   ` Luca Ferrari
@ 2022-09-26 15:17     ` Ihor Radchenko
  2022-09-27 12:42       ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2022-09-26 15:17 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

> On Mon, Sep 26, 2022 at 6:41 AM Ihor Radchenko <yantar92@gmail.com> wrote:
>> Thanks for reporting!
>> May you
>> 1. M-x profiler-start <RET> cpu <RET>
>> 2. Move/paste/edit your source block
>> 3. M-x profiler-report <RET>
>> 4. M-x profiler-report-write-profile and share the resulting file here
>
> Apparently I'm not able to get the profiler report written.
> However, I discovered that, for instance, when I'm editing a piece of
> code with regexp Emacs seems to suffer, at least it is the only
> chances I had today to get it slower.
> The messages buffer does not help very much:
>
> CPU and memory profiler started
> End of ‘m/ ... /’ string/RE not found: (scan-error Unbalanced parentheses 74 82)
> Auto-saving...done
> CPU and memory profiler stopped
> profiler-write-profile: Wrong type argument: arrayp, nil

I think you tried to use M-x profiler-stop instead of M-x profiler-report
M-x profiler-report show yield a new buffer displayed the profiler tree.
M-x profiler-write-profile will work from inside that buffer.

You can refer to https://cubeatic.com/index.php/s/iQakFWXgxsJzyXP
(around 22:00) for a more detailed showcase.

> Oh, I also tried to disable flyspell, but it seems to me it gets
> re-enabled for the source code block I'm within (but it's just a
> feeling).
>
> Any idea?

Another thing you can try is setting org-src-fontify-natively to nil in
your config.

-- 
Ihor Radchenko,
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


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

* Re: emacs really slow when inserting a new source code block
  2022-09-26 15:17     ` Ihor Radchenko
@ 2022-09-27 12:42       ` Luca Ferrari
  2022-09-27 13:23         ` Ihor Radchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-27 12:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Mon, Sep 26, 2022 at 5:16 PM Ihor Radchenko <yantar92@gmail.com> wrote:
> I think you tried to use M-x profiler-stop instead of M-x profiler-report
> M-x profiler-report show yield a new buffer displayed the profiler tree.
> M-x profiler-write-profile will work from inside that buffer.

I was careful to do the steps in the right order, and my message
buffer tells the profiler has been stopped after the write profiler
fails:

CPU and memory profiler started
Mark set
Auto-saving...done
Saving file /home/luca/git/talks/perl/perl5/PERL-VARIABILI.org...
Wrote /tmp/.!home!luca!git!talks!perl!perl5!PERL-VARIABILI.org.~undo-tree~
Wrote /home/luca/git/talks/perl/perl5/PERL-VARIABILI.org
syntax error
Saving file /home/luca/git/talks/perl/perl5/examples/autovivification.pl...
Wrote /tmp/.!home!luca!git!talks!perl!perl5!examples!autovivification.pl.~undo-tree~
Wrote /home/luca/git/talks/perl/perl5/examples/autovivification.pl
Mark activated
Mark deactivated
Mark activated
Saving file /home/luca/git/talks/perl/perl5/examples/autovivification.pl...
Wrote /tmp/.!home!luca!git!talks!perl!perl5!examples!autovivification.pl.~undo-tree~
Wrote /home/luca/git/talks/perl/perl5/examples/autovivification.pl
Mark set
Auto-saving...done
Saving file /home/luca/git/talks/perl/perl5/PERL-VARIABILI.org...
Wrote /tmp/.!home!luca!git!talks!perl!perl5!PERL-VARIABILI.org.~undo-tree~
Wrote /home/luca/git/talks/perl/perl5/PERL-VARIABILI.org
profiler-write-profile: Wrong type argument: arrayp, nil
CPU and memory profiler stopped
Reverted buffer

> Another thing you can try is setting org-src-fontify-natively to nil in
> your config.
>

I'm trying it right now, after reverting the buffer I was editing (I
applied it with M-x set-variable).
I will see if I suffer from other slowing down.

Thanks,
Luca


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

* Re: emacs really slow when inserting a new source code block
  2022-09-27 12:42       ` Luca Ferrari
@ 2022-09-27 13:23         ` Ihor Radchenko
  2022-09-28 12:55           ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2022-09-27 13:23 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

> On Mon, Sep 26, 2022 at 5:16 PM Ihor Radchenko <yantar92@gmail.com> wrote:
>> I think you tried to use M-x profiler-stop instead of M-x profiler-report
>> M-x profiler-report show yield a new buffer displayed the profiler tree.
>> M-x profiler-write-profile will work from inside that buffer.
>
> I was careful to do the steps in the right order, and my message
> buffer tells the profiler has been stopped after the write profiler
> fails:
> ...
> profiler-write-profile: Wrong type argument: arrayp, nil
> CPU and memory profiler stopped
> Reverted buffer

This is strange.
Did nothing happen after M-x profiler-report?
Can you try again and check if *CPU-Profiler-Report ...* buffer exists
in Emacs (... will be current date and time)?

-- 
Ihor Radchenko,
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


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

* Re: emacs really slow when inserting a new source code block
  2022-09-27 13:23         ` Ihor Radchenko
@ 2022-09-28 12:55           ` Luca Ferrari
  2022-09-28 13:16             ` Ihor Radchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-28 12:55 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Tue, Sep 27, 2022 at 3:22 PM Ihor Radchenko <yantar92@gmail.com> wrote:
>
> This is strange.
> Did nothing happen after M-x profiler-report?
> Can you try again and check if *CPU-Profiler-Report ...* buffer exists
> in Emacs (... will be current date and time)?

No, there is no buffer named cpu nor memory nor something alike in the
buffer list.

Besides, I'm now more able to reproduce the original issue: I open one
of my perl-based org files, and it takes a lot, then I switch to
overview and it requires almost a minute to collapse all the headings.
Never seen nothing like this before.

Luca


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

* Re: emacs really slow when inserting a new source code block
  2022-09-28 12:55           ` Luca Ferrari
@ 2022-09-28 13:16             ` Ihor Radchenko
  2022-09-28 14:15               ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2022-09-28 13:16 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

> No, there is no buffer named cpu nor memory nor something alike in the
> buffer list.

I have not idea except that you may have something really strange in
your config.

> Besides, I'm now more able to reproduce the original issue: I open one
> of my perl-based org files, and it takes a lot, then I switch to
> overview and it requires almost a minute to collapse all the headings.
> Never seen nothing like this before.

What if you open the file in a clean Emacs instance? See
https://orgmode.org/manual/Feedback.html

-- 
Ihor Radchenko,
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


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

* Re: emacs really slow when inserting a new source code block
  2022-09-28 13:16             ` Ihor Radchenko
@ 2022-09-28 14:15               ` Luca Ferrari
  2022-09-28 14:21                 ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-28 14:15 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Wed, Sep 28, 2022 at 3:15 PM Ihor Radchenko <yantar92@gmail.com> wrote:
> I have not idea except that you may have something really strange in
> your config.

I'm trying to understand what could be eating all the cpu.

> What if you open the file in a clean Emacs instance? See
> https://orgmode.org/manual/Feedback.html

Clearly, -Q makes emacs work like a charm.

Luca


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

* Re: emacs really slow when inserting a new source code block
  2022-09-28 14:15               ` Luca Ferrari
@ 2022-09-28 14:21                 ` Luca Ferrari
  2022-09-29  2:28                   ` Ihor Radchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-28 14:21 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Wed, Sep 28, 2022 at 4:15 PM Luca Ferrari <fluca1978@gmail.com> wrote:
>
> On Wed, Sep 28, 2022 at 3:15 PM Ihor Radchenko <yantar92@gmail.com> wrote:
> > I have not idea except that you may have something really strange in
> > your config.
>
> I'm trying to understand what could be eating all the cpu.
>

So far, turning off flyspell-mode makes Emacs work fine again. Strange...


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

* Re: emacs really slow when inserting a new source code block
  2022-09-28 14:21                 ` Luca Ferrari
@ 2022-09-29  2:28                   ` Ihor Radchenko
  2022-09-29 14:10                     ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2022-09-29  2:28 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

>> I'm trying to understand what could be eating all the cpu.
>>
>
> So far, turning off flyspell-mode makes Emacs work fine again. Strange...

Do you have any flyspell-related configuration in your config?

-- 
Ihor Radchenko,
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


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

* Re: emacs really slow when inserting a new source code block
  2022-09-29  2:28                   ` Ihor Radchenko
@ 2022-09-29 14:10                     ` Luca Ferrari
  2022-09-29 14:19                       ` Ihor Radchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ferrari @ 2022-09-29 14:10 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Thu, Sep 29, 2022 at 4:27 AM Ihor Radchenko <yantar92@gmail.com> wrote:
>
> Luca Ferrari <fluca1978@gmail.com> writes:
>
> >> I'm trying to understand what could be eating all the cpu.
> >>
> >
> > So far, turning off flyspell-mode makes Emacs work fine again. Strange...
>
> Do you have any flyspell-related configuration in your config?

I have:
(flyspell-mode +1)
(global-flycheck-mode +1)

By the way, even if off-topic, is there a way to "dump" configuration
for a specific set of modes? Fromwithin emacs, how can I get a dump of
all flyspell related settings (if there's a way)?

Thanks,
Luca


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

* Re: emacs really slow when inserting a new source code block
  2022-09-29 14:10                     ` Luca Ferrari
@ 2022-09-29 14:19                       ` Ihor Radchenko
  2022-10-05  6:03                         ` Luca Ferrari
  0 siblings, 1 reply; 14+ messages in thread
From: Ihor Radchenko @ 2022-09-29 14:19 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

>> Do you have any flyspell-related configuration in your config?
>
> I have:
> (flyspell-mode +1)
> (global-flycheck-mode +1)

Hmm. Can you try the development version of Org?
If you are just using a bare flyspell-mode, it generally gets slow on
large Org files. We have made a number of improvements in this area on
development branch.

> By the way, even if off-topic, is there a way to "dump" configuration
> for a specific set of modes? Fromwithin emacs, how can I get a dump of
> all flyspell related settings (if there's a way)?

Usually, you can just re-search for appropriate Elisp variable prefix.
Or, if you use customize interface, saving customization will dump all
the non-default settings into your init.el
Or you can bisect the config to hunt for less obvious issues using
https://github.com/Malabarba/elisp-bug-hunter

-- 
Ihor Radchenko,
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


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

* Re: emacs really slow when inserting a new source code block
  2022-09-29 14:19                       ` Ihor Radchenko
@ 2022-10-05  6:03                         ` Luca Ferrari
  0 siblings, 0 replies; 14+ messages in thread
From: Luca Ferrari @ 2022-10-05  6:03 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Thu, Sep 29, 2022 at 4:19 PM Ihor Radchenko <yantar92@gmail.com> wrote:
> Or you can bisect the config to hunt for less obvious issues using
> https://github.com/Malabarba/elisp-bug-hunter
>

I'm preparing a new machine right now, so I will plug into the emacs
configuration one bit ata time and see when the problem manifests.
I will report back.
Thanks,
Luca


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

end of thread, other threads:[~2022-10-05  6:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 17:35 emacs really slow when inserting a new source code block Luca Ferrari
2022-09-26  4:42 ` Ihor Radchenko
2022-09-26 15:07   ` Luca Ferrari
2022-09-26 15:17     ` Ihor Radchenko
2022-09-27 12:42       ` Luca Ferrari
2022-09-27 13:23         ` Ihor Radchenko
2022-09-28 12:55           ` Luca Ferrari
2022-09-28 13:16             ` Ihor Radchenko
2022-09-28 14:15               ` Luca Ferrari
2022-09-28 14:21                 ` Luca Ferrari
2022-09-29  2:28                   ` Ihor Radchenko
2022-09-29 14:10                     ` Luca Ferrari
2022-09-29 14:19                       ` Ihor Radchenko
2022-10-05  6:03                         ` Luca Ferrari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).