[Geany-Devel] [FT-plugins] Proposed "Features"

Matthew Brush mbrush at xxxxx
Thu Sep 1 01:24:39 UTC 2016


On 2016-08-31 08:15 AM, Jiří Techet wrote:
> On Wed, Aug 31, 2016 at 1:22 PM, Thomas Martitz <kugel at rockbox.org> wrote:
> [...]
>> Wait, a AST comprising a million nodes doesn't result in a million
>> autocompletion candidates. Anyway, how does the number relate to our
>> discussion?
>
>
> It appears to me you don't really read what I'm writing - I'm talking about
> updating TM workspace tags which has to happen every time file is reparsed.
> As I said, autocompletion list population performance doesn't matter much
> because it will contain a lot less tags.
>
> And by the way, projects with 1 000 000 tags will have more like 100 000
> 000 nodes in AST.
>

To give a sensational example, a minimal "hello world" C++ program:

     #include <iostream>
     int main()
     {
         std::cout << "Hello World" << std::endl;
         return 0;
     }

CTags:

     $ ctags -o - hello-world.cc | wc -l
     1

Clang AST:

     $ clang++ -Xclang -ast-dump -fno-diagnostics-color \
         -fsyntax-only hello-world.cc | wc -l
     37806

Obviously since C++ compilers operate on translation units, the latter 
includes all of what's brought in through includes. If I manually strip 
it down to just what humans see in the source file, it's around 15 
lines, but the 37806 is what a libclang ft-plugin would be working with 
in the AST.

I couldn't speculate what a larger project like LLVM itself would parse 
to, but I suspect it would take a not-insignificant amount of time for 
an ft-plugin to even traverse the AST once (eg. to find all the nodes 
originating in a particular source file).

Cheers,
Matthew Brush


More information about the Devel mailing list