Page MenuHomePhabricator

[libclang][index] Skip already indexed function bodies more aggressively

Authored by jkorous on Aug 23 2019, 4:02 PM.



It seems like there's no reason not to use the up-to-date information we have in TUSkipBodyControl::isParsed().

I compared performance on small part of clang compilation database - seems like it might be tiny bit faster.


/usr/bin/time fish -c "bin/c-index-test -index-compile-db compile_commands.json > /dev/null ^ /dev/null"

master 30.66 real 30.20 user 0.45 sys
master 30.49 real 29.98 user 0.47 sys
master 30.34 real 29.88 user 0.45 sys

patched 30.41 real 29.95 user 0.45 sys
patched 29.89 real 29.44 user 0.44 sys
patched 29.72 real 29.26 user 0.45 sys

Diff Detail

Event Timeline

jkorous created this revision.Aug 23 2019, 4:02 PM

Are you sure the difference is not random noise? It's not clear to me under which conditions you would encounter the same region in NewParsedRegions within the same TU. I assume this would be the case if the same file is parsed multiple times, but I'd expect this to be uncommon within the same TU.
I'd recommend to add some counters of when NewParsedRegions.count(region) is true and when ParsedRegions.count(region) is true, and print them at the end.

jkorous abandoned this revision.Aug 23 2019, 4:30 PM

Actually, I suppose you are right - it would be ODR-violation otherwise. Never mind.