It's very slow while opening company mode for editing large file with over 10000 lines.
guoqinglei opened this issue · 5 comments
I wonder how to fix this problem ? Anyone any suggestion ?
In major mode hook, you can (setq-local company-backends nil)
, you can use other value than nil.
If you know how to write your own company-backend (one chapter of tutorial https://edu.51cto.com/sd/de7e7 teach how to write it), you know the performance of company is dependent on backend. Some backend is just slower, maybe company-dabbrev
is the trouble maker?
Thank you for your reply. I would have a try to verify the problem.
Another operation that could invoke similar "slow" problem while ending a file with over 10000 lines is: press "Enter" key at the end of a comment line, e.g., "//this is a comment line ...". When I do this operation, Emacs is stalled while the cpu occupation is 100% for emacs. I do not know why this would happen ? Maybe indentation cause this problem ?
Use profile-start
to get the report and send it to me. See https://github.com/redguardtoo/emacs.d#why-opening-file-is-slow (replace open file code with forward-line
or goto-char
)
Thanks for your advice. I have tried it. And the cause is function "indent-according-to-mode” which occupies 97% of cpu time, while I am editing a file with 100000 lines with verilog-mode.
Could I set the variable "evil-auto-indent" to nil to improve the performance ?
Not sure. See doc of indent-according-to-mode
, you might need set up indent-line-function
.