[cfe-dev] Clang-based autocompletion speed
Manuel Klimek via cfe-dev
cfe-dev at lists.llvm.org
Mon Jan 11 03:44:04 PST 2016
looping in a couple of people working in that area
On Sat, Jan 9, 2016 at 3:54 AM Val Markovic <val at markovic.io> wrote:
> For YCM, we pass a the CXTranslationUnit_Incomplete flag
> <https://github.com/Valloric/ycmd/blob/master/cpp/ycm/ClangCompleter/TranslationUnit.cpp#L38>
> that provides a massive boost to performance. It doesn't do what you're
> asking for though (which BTW would be great).
>
Note that the implementation Maksym talks about already uses that flag.
> On Thu, Jan 7, 2016 at 1:34 PM, Maksym Taran <mtaran at google.com> wrote:
>
>> Hello!
>>
>> I'm looking into improving how an autocomplete system at Google computes semantic
>> autocompletions for a given C++ file + line + column. Currently, it's
>> mostly just calling out to clang_codeCompleteAt
>> <https://github.com/llvm-mirror/clang/blob/52ed5ec631b0bbf5c714baa0cd83c33ebfe0c6aa/tools/libclang/CIndexCodeCompletion.cpp#L798>,
>> and that's where we've been seeing high latency.
>>
>> A particular problem we're having is that when we try to autocomplete
>> just within some scope (that is, just inside a function body, rather than
>> after a . or -> etc), calling that method returns *all* possible
>> autocompletion results, which includes all constants and class names
>> defined in all the transitively included files as far as I can tell. This
>> is technically correct, but in practice takes on the order of seconds to
>> return, which is much longer than the desired timeframe for autocompletion
>> results. So I'd like to know if there's some way I can get a smaller set of
>> autocompletions more quickly, e.g. by asking clang to complete only on
>> method names and locals, or by giving a time limit to get results. I didn't
>> see how I might do that in the documentation
>> <http://clang.llvm.org/doxygen/group__CINDEX__CODE__COMPLET.html#ga50fedfa85d8d1517363952f2e10aa3bf> so
>> I'm wondering if there are some other APIs I'm not seeing.
>>
>> I took a look at YouCompleteMe
>> <https://github.com/Valloric/YouCompleteMe> and it's using the same API
>> <https://github.com/Valloric/ycmd/blob/master/cpp/ycm/ClangCompleter/TranslationUnit.cpp#L176>,
>> so I suspect it might have the same problem. If there's no way to do
>> something like this using the current API methods, I'd be interested to
>> know how possible/difficult would it be to implement additional methods or
>> options?
>>
>> Thank you!
>> Maksym
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160111/34ecfdb3/attachment.html>
More information about the cfe-dev
mailing list