Find uses/rename is being painfully slow

David Nolden zwabel at googlemail.com
Fri Feb 18 09:21:03 UTC 2011


For full-project parsing, we collect a reduced amount of information,
where basically only the types of globally accessible objects are
processed fully (for example functions), but the actual code contained
by functions is not processed at all, and uses are not built at all.

You can experiment with this using the "duchainify" command-line
utility, and you will see that building the full duchain with uses
etc. is something like 50 times slower then the reduced version.

Basically, the "find uses" (and replace) code works like this:
* Collect all declarations of the function we want to find uses for
* Collect all source files that recursively include the headers
containing these declarations
* Build the "full" duchain for all those source files

When there are many source files including the given header(s), then
this will become painfully slow.

There are two things we could do to speed this up:
1. Do a simple "grep" to filter out source files that can not contain
uses of the given object (this will break with uses within macro
invocations though)
2. (optional) Only build uses for contexts that contain an appearance
of the string found by the "grep".

Each of these would bring a huge improvement, but the second is pretty
complicated to do.

Greetings, David




More information about the KDevelop-devel mailing list