Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's very slow while opening company mode for editing large file with over 10000 lines. #1040

Open
guoqinglei opened this issue Apr 6, 2023 · 5 comments

Comments

@guoqinglei
Copy link

guoqinglei commented Apr 6, 2023

I wonder how to fix this problem ? Anyone any suggestion ?

@redguardtoo
Copy link
Owner

redguardtoo commented Apr 6, 2023

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?

@guoqinglei
Copy link
Author

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 ?

@redguardtoo
Copy link
Owner

redguardtoo commented May 24, 2023

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)

@guoqinglei
Copy link
Author

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 ?

@redguardtoo
Copy link
Owner

Not sure. See doc of indent-according-to-mode, you might need set up indent-line-function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants