irony-mode icon indicating copy to clipboard operation
irony-mode copied to clipboard

High completion latency when working with large codebase

Open amol-mandhane opened this issue 7 years ago • 4 comments

I'm using irony-mode with a huge codebase (O(100k) header files) on a linux machine. Completion quality is quite good but the latency for suggesting completion is 4-5 seconds, which makes it difficult to use irony-mode with company-irony.

Is there any way to improve the completion performance? From my CPU usage, irony-mode seems to be using one thread for completion. Multithreading can be a good way to improve the performance. The code indexing can be done in the background thread and completion lookup can be done on request thread. Or simply the completion lookup can be parallelized.

amol-mandhane avatar Jul 20 '17 22:07 amol-mandhane

irony-server uses libclang for completion. EIther I'm misusing the API or the operation is simply slow in libclang. Either way, if the solution is multithreading or any other smart indexing, it is out of the league for irony-server.

The next step in this direction would be clangd in my opinion: https://github.com/llvm-mirror/clang-tools-extra/tree/master/clangd

Which I'm not sure is easy to use with Emacs yet.

Sarcasm avatar Jul 21 '17 11:07 Sarcasm

I guess the reason might be libclang outputs too many candidates. Is it possible to pass 'prefix' parameter to irony-server and filter the complete result in irony-server?

kangjianbin avatar Jul 28 '17 12:07 kangjianbin

Is it possible to pass 'prefix' parameter to irony-server and filter the complete result in irony-server?

It is technically possible, and I had a refactoring "somewhat recently" to allow to add more commands. Prefix filtering (fuzzy or not) was one of the use case I had in mind. So the only thing required is to code it, which I don't plan to do anytime soon but would be happy to give guidance/review.

Sarcasm avatar Jul 28 '17 12:07 Sarcasm

Hi Saracasm, I just created a pull request #412 to support the filtering. We still need to modify company-irony to support it. I will send other request if #412 is accepted.

Any suggestions?

kangjianbin avatar Jul 30 '17 16:07 kangjianbin