On 03/25/2013 06:03 PM, Barry OReilly wrote:
> > The easiest way is to use GNU Global. It will tell Semantic where it can
> > find symbols of this name, and it will then visit those symbols and
> > check if it is the correct definition to your declaration.
>
> I downloaded latest GNU Global (6.2.8), ran gtags at the root, opened my
> Util.h only, issued semantic-analyze-proto-impl-toggle for myUtilFunc,
> waited for 26 minutes, and then Semantic successfully opened Util.cc and
> placed me at myUtilFunc's definition. To keep whatever caches there are
> warm, I kept the same Emacs session open, including the Util.h and
> Util.cc buffers, went to the same declaration of myUtilFunc in Util.h,
> and issued semantic-analyze-proto-impl-toggle again. This caused
> another 26 minute wait. During the command, Emacs visits many .cc
> files, which are in same the source tree but have nothing to do with my
> Util class.
>
> I executed 'global myUtilFunc' at the command line and that returns very
> quickly with two .cc files, one of which is the correct one. Another
> class has a function of the same name.
>
> Here's the top lines of an elp profile of the
> semantic-analyze-proto-impl-toggle command:
>
> semantic-analyze-proto-impl-toggle 1
> 1591.447626 1591.447626
> semantic-analyze-tag-references 1
> 1591.444366 1591.444366
> semantic-analyze-tag-references-default 1
> 1591.444355 1591.444355
> semantic--analyze-refs-full-lookup 1
> 1591.078446 1591.078446
> semantic--analyze-refs-full-lookup-with-parents 1
> 1591.078438 1591.078438
> semanticdb-find-tags-collector 3
> 1590.857997 530.28599900
> semanticdb-find-tags-by-name-method 61
> 1590.700132 26.077051344
> semanticdb-deep-find-tags-by-name-method 119
> 1589.770119 13.359412764
> semantic-symref-result-get-tags 2
> 1589.478069 794.7390345
Well, here's a problem. When adding GNU Global, when it is called via
semanticdb-deep-find-tags-by-name, it has to convert all those hits into
tags. The only way it can do that is to load the file into a buffer,
put the cursor at the hit location, and extract the tag.
The problem is that code changes out from under GNU Global, so as you
edit code, the line numbers change, so we need to snoop around to find
the tag you're looking for.
I'm guessing we could have a fast mode that doesn't do that, and just
'trusts' that if it finds a tag by name around some line number, that is
good enough.
Of course, why are there 1238 hits from global? I'm guessing from your
explanation above that the parent of myUtilFunc is some generic word
like "std" or something. In order for the impl-proto jump to work, it
has to find the correct parent of the symbol you want to toggle on on
the off chance that your tag is in a bunch of different names
spaces/classes.
The assumption, of course, is that you might have oodles of hits on the
tag name, and less on the parent name, but your case is the opposite.
A quick hack might be to visit the function
semantic--analyze-refs-full-lookup and force the if statement to only do
the simple lookup. If it "works" and is fast, then we'll know we're on
the right track, and perhaps that code should do the simple search
first, see if it is successful, then try the slower version.
> semantic-find-file-noselect 1238
> 1542.5541070 1.2460049329
Yep, 1238 file hits. That's a lot of files to open. Twice.
Not sure about the 26 minutes though. That's just crazy.
Eric
|