Review Request 123810: Make code-completion faster

Olivier Jean de Gaalon olivier.jg at gmail.com
Sun May 17 13:56:26 UTC 2015



On May 16, 2015, 9:04 a.m., Sergey Kalinichev wrote:
> > That speedup sounds really good. I wonder if we shouldn't add some warning output if it has to fallback to findDeclaration so that we know if we're missing something that should be added to the cache. Or are there some known cases that aren't worth adding?
> > 
> > Caching the cache might be worth something as well... I don't have the time to look into this now, but I wonder if the symbol table could be used directly for the lookup since we already have the qid? This wouldn't find function-local declarations, but that could be handled specially.
> 
> Sergey Kalinichev wrote:
>     >I wonder if we shouldn't add some warning output if it has to fallback to findDeclaration so that we know if we're missing something that should be added to the cache. Or are there some known cases that aren't worth adding?
>     
>     The latter one. There'll be about 10-50 items out of 3-5 thousand, like: NS::Enem::Enumerator when completion invoked in the function scope ( i.e. the Other context)
>     
>     >Caching the cache might be worth something as well... I don't have the time to look into this now, but I wonder if the symbol table could be used directly for the lookup since we already have the qid? This wouldn't find function-local declarations, but that could be handled specially.
>     
>     Are you suggesting to use the symbol table lookup instead of calling allDeclarations/findDeclaration? I don't think it's worth it, because e.g. for me the allDeclarations call takes about 30ms, clang code-completion about 70ms and processing all those thousands of completion items 100ms.

(Is this missing a diff V2? I don't see the changes you resolved)

Does allDeclarations + populating the QHash take 30ms? Or just the call to allDeclarations? If the latter, we should maybe add a member function to build the allDeclarations hash directly.

I'm still curious as to how PersistentSymbolTable::getDeclarations on each qid would perform, but indeed I can't imagine it's close enough to beat the QHash building overhead.


- Olivier Jean de


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123810/#review80455
-----------------------------------------------------------


On May 16, 2015, 8:13 a.m., Sergey Kalinichev wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123810/
> -----------------------------------------------------------
> 
> (Updated May 16, 2015, 8:13 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-clang
> 
> 
> Description
> -------
> 
> Instead of calling findDeclarations for each item found by clang, call allDeclarations once and cache the result. In case it can't find anything fall back to the findDeclarations.
>     
> This reduces code-completion time on average from 2000ms to 200ms for me.
> 
> 
> Diffs
> -----
> 
>   codecompletion/context.cpp 5027dcd 
> 
> Diff: https://git.reviewboard.kde.org/r/123810/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sergey Kalinichev
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20150517/0e1dee15/attachment.html>


More information about the KDevelop-devel mailing list