I recently upgraded from emacs 28.2 to 29.3. When I resumed working in a large 11MB org-mode file that never gave me problems with speed on 28.2, I noticed a severe slowdown when editing the buffer after invoking counsel-outline. It took a while for me to isolate the issue, but it seems to be caused by the many markers that this command creates in the buffer.
Here are the steps to reproduce the issue:
Start emacs 29.3 with emacs -q to ensure a clean environment.
Paste this minimal config into the scratch buffer and eval-buffer.
Invoke counsel-outline and simply press enter to navigate point to the headline at line 34.
Go to the end of the line and press enter to start typing on a new line at line 35.
Start typing nspace, or tspace several times very fast and observe how long it takes for the abbrev expansions (defined in the minimal config above) to show up on the screen.
To verify this slowdown doesn’t occur before invoking counsel-outline, you can try doing Step 7 after Step 4 and see how fast the abbrevs expand. You can also repeat Steps 1 through 7 above but with emacs -q using emacs version 28.2 and see that no slowdown occurs at Step 7.
Using emacs 29.3, when I use profiler-start (CPU) between Steps 4 and 5, and then profiler-stop after Step 7, I get a very big entry (e.g., 70%) for redisplay_internal (C function) in the profiler-report. Using the profiler at the same steps using emacs 28.2, I don’t get a big entry for redisplay_internal (C function).
This slowdown even in emacs 29.3 only seems to occur with larger files like the test file. I’ve tried many different setups to avoid the problem, including different versions of org-mode, but the only thing that solves it is going back to emacs 28.2, which apparently handles markers more efficiently. The only way to solve the problem within emacs 29.3 I’ve found is to use a different version of counsel-outline that gets rid of all the markers it creates, as suggested here. The specific modifications I use can be found here (I eval these functions after I’ve loaded counsel).
My tentative conclusion is that this slowdown is NOT a bug with counsel but rather in emacs 29.3, but I wanted to make sure before I report the bug to emacs developers. I have noticed a similar slowdown when editing the test file after invoking org-refile when org-refile-use-cache is set to t, and my understanding is that org-refile-use-cache will also make org-refile create a ton of markers in the buffer.
Even if this is an issue with 29.3, it might still be worth it to create a user option in counsel to turn off the creation of markers by counsel-outline. Even though that might render ivy-resume ineffective regarding counsel-outline, that is worth the tradeoff for some of us.
I recently upgraded from emacs 28.2 to 29.3. When I resumed working in a large 11MB org-mode file that never gave me problems with speed on 28.2, I noticed a severe slowdown when editing the buffer after invoking
counsel-outline
. It took a while for me to isolate the issue, but it seems to be caused by the many markers that this command creates in the buffer.Here are the steps to reproduce the issue:
emacs -q
to ensure a clean environment.eval-buffer
.goto-line
35.counsel-outline
and simply pressenter
to navigate point to the headline at line 34.enter
to start typing on a new line at line 35.n
space
, ort
space
several times very fast and observe how long it takes for the abbrev expansions (defined in the minimal config above) to show up on the screen.To verify this slowdown doesn’t occur before invoking
counsel-outline
, you can try doing Step 7 after Step 4 and see how fast the abbrevs expand. You can also repeat Steps 1 through 7 above but withemacs -q
using emacs version 28.2 and see that no slowdown occurs at Step 7.Using emacs 29.3, when I use
profiler-start
(CPU) between Steps 4 and 5, and thenprofiler-stop
after Step 7, I get a very big entry (e.g., 70%) forredisplay_internal (C function)
in theprofiler-report
. Using theprofiler
at the same steps using emacs 28.2, I don’t get a big entry forredisplay_internal (C function)
.This slowdown even in emacs 29.3 only seems to occur with larger files like the test file. I’ve tried many different setups to avoid the problem, including different versions of org-mode, but the only thing that solves it is going back to emacs 28.2, which apparently handles markers more efficiently. The only way to solve the problem within emacs 29.3 I’ve found is to use a different version of
counsel-outline
that gets rid of all the markers it creates, as suggested here. The specific modifications I use can be found here (Ieval
these functions after I’ve loadedcounsel
).My tentative conclusion is that this slowdown is NOT a bug with
counsel
but rather in emacs 29.3, but I wanted to make sure before I report the bug to emacs developers. I have noticed a similar slowdown when editing the test file after invokingorg-refile
whenorg-refile-use-cache
is set tot
, and my understanding is thatorg-refile-use-cache
will also makeorg-refile
create a ton of markers in the buffer.Even if this is an issue with 29.3, it might still be worth it to create a user option in
counsel
to turn off the creation of markers bycounsel-outline
. Even though that might renderivy-resume
ineffective regardingcounsel-outline
, that is worth the tradeoff for some of us.Thank you so much!