Review Request 123810: Make code-completion faster
Sergey Kalinichev
kalinichev.so.0 at gmail.com
Sun May 24 07:46:14 UTC 2015
> On May 18, 2015, 7:21 p.m., Milian Wolff wrote:
> > codecompletion/context.cpp, line 370
> > <https://git.reviewboard.kde.org/r/123810/diff/2/?file=369754#file369754line370>
> >
> > why the conditional here? shouldn't it always be
> >
> > declaration.first->qualifiedIdentifier()
>
> Sergey Kalinichev wrote:
> No. That way we won't find function-local declarations, because for them qid is: "function::declaration" and id is "declaration".
>
> Milian Wolff wrote:
> ah ok. is that correct behavior of Declaration::qualifiedIdentifier? anyways, please document why this is necessary.
>
> Sergey Kalinichev wrote:
> Also qid for class members is "member" instead of "Class::member". Seems like it's a bug in allDeclarations(..) - because findDeclarations(..) returns items with valid qid's. So, I've added a couple of TODO notes.
Never mind. I've figured it out.
> On May 18, 2015, 7:21 p.m., Milian Wolff wrote:
> > codecompletion/context.cpp, line 372
> > <https://git.reviewboard.kde.org/r/123810/diff/2/?file=369754#file369754line372>
> >
> > this will break on nested namespaces, no? so shouldn't it recurse here instead into the internalContext?
> >
> > also, please add a comment here explaining what this does: "also include declarations in namespaces", and below "also include enumerators" or similar.
>
> Sergey Kalinichev wrote:
> Yes, it makes sense. I'll do it that way.
I've just tested it a bit more. Seems like it's not worth it, because with deep namespace hierarchies we spend a lot of time generating cache, so the findDeclarations call actually becomes much cheaper.
I'll commit the initial patch + more comments.
- Sergey
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123810/#review80583
-----------------------------------------------------------
On May 22, 2015, 11:08 a.m., Sergey Kalinichev wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123810/
> -----------------------------------------------------------
>
> (Updated May 22, 2015, 11:08 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
> tests/test_codecompletion.cpp de5987a
>
> 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/20150524/e43fb4db/attachment.html>
More information about the KDevelop-devel
mailing list