helm-get-candidates performance issue? #2484
Replies: 5 comments 4 replies
-
LiuGavin ***@***.***> writes:
I was using magit in emacs, and whenever it a 'diff' on a relative-large(maybe hundreds diffs), it performed badly and the CPU is at 100% for a couple of minutes.. below is my
"profiler-report" when it's slow.-->
- complete-with-action 162476 95%
- #<lambda 0xfc457663eef3ce8> 162476 95%
- let* 162476 95%
- completion-all-completions 162373 95%
- completion--nth-completion 162373 95%
- completion--some 162373 95%
- #<compiled 0x423eb7d> 162373 95%
- helm-completion-all-completions 162136 95%
- let* 162136 95%
- helm-completion--multi-all-completions 162135 95%
- let* 162135 95%
- helm-completion--multi-all-completions-1 162135 95%
If this is called I guess you are using 'emacs as
`helm-completion-style` value, right?
Helm is using 'helm as value to avoid using native emacs completion API
which is slow.
So what is slow here is not `helm-get-candidates` but the emacs
completion default system (basically all what is in minibuffer.el).
I suggest using helm default value for `helm-completion-style` which
should be much faster.
…--
Thierry
|
Beta Was this translation helpful? Give feedback.
-
LiuGavin ***@***.***> writes:
Thanks for the quick response. I am new to Helm, and not sure how to set 'helm-complemtion-style' properly in emacs.
'(helm-completion-style 'emacs)
'(completion-styles '(flex)) // ---> I added this line here, but it does not seem to help?
'(helm-mode t)
what should I set instead?
First of all, it looks you have your custom stuff in your init.el or
.emacs.el file, right?
If so separate your custom stuff from your personal config in init.el.
(setq custom-file "~/.emacs.d/.emacs-custom.el")
Then move all what you have at end of your init.el file in
.emacs-custom.el (what starts by "(custom-set-variables...")
Now you can either use customize interface to customize your user vars
like helm-completion-style or remove this entry in .emacs-custom.el
file, then helm will use the default value which is 'helm.
For helm-mode you can remove the entry in .emacs-custom.el and add to
init.el file:
(helm-mode 1)
Once helm-completion-style is set to 'helm completion-styles will have
no more effect in helm.
Don't forget to load the .emacs-custom.el file from your init.el file:
(load custom-file)
As helper, my config file for helm is here:
https://github.com/thierryvolpiatto/emacs-config/blob/main/init-helm.el
And init file for emacs here:
https://github.com/thierryvolpiatto/emacs-config/blob/main/init.el
…--
Thierry
|
Beta Was this translation helpful? Give feedback.
-
Also about setting variables in emacs: Normally you can use |
Beta Was this translation helpful? Give feedback.
-
LiuGavin ***@***.***> writes:
Do you mind to do a 'diff' in your environment to see what's the
performance there? I attached two text files here. I put b2.csv
'staged' in magit first then rename c2.csv to b2.csv, hightlight it
then emacs running 100%CPU at this point for me. b2.csv c2.csv
How diff would involve helm?
Can you be more specific on what you are doing exactly?
A recipe would be nice.
Also how did you install helm? Do you use a minimal install or are you
using a preconfigured emacs (spacemacs, doom or whatever)?
Thanks.
…--
Thierry
|
Beta Was this translation helpful? Give feedback.
-
LiuGavin ***@***.***> writes:
I installed the 'magit' from here: https://magit.vc/manual/magit/Installing-from-Melpa.html
To use Melpa-Stable:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(I already have 'git' installed in my linux). once magit installed ,
try to create a new git project(or any existing git project would be
fine), copy b2.csv to this directory, in magit press 'ctrl x+g' to
bring up the git repo, highlight b2.csv and press "s" to stages it(try
to use it as a baseline). copy c2.csv to this directory, rename it to
'b2.csv'(mimic the case some new changes made to b2.csv), press 'g' in
magit to refresh the git repo, you should see "Unstaged" b2.csv and
"Staged" b2.csv , hightlight the "Unstaged" b2.csv file in magit,
(where I believe it's doing the 'diff' here, because once it's
finished it will show the diff result between 'unstaged' and 'staged'
version of the b2.csv.) and here is where I did the 'profiler report'
and see the 100%CPU.
I installed magit and followed your recipe, the delay you see is due to
magit preparing the diff, not helm.
You can verify by turning off helm-mode and run the same command from
magit, you will see the delay before the diff popup is the same.
…--
Thierry
|
Beta Was this translation helpful? Give feedback.
-
I was using magit in emacs, and whenever it a 'diff' on a relative-large(maybe hundreds diffs), it performed badly and the CPU is at 100% for a couple of minutes.. below is my "profiler-report" when it's slow.-->
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions