Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Eric M. Ludlam <eric@si...> - 2007-09-11 11:26:57
After a couple weeks of hacking around in Semantic, I made several
check-ins over the weekend. I started just trying to get 'using'
statements in C++ working as members of the local scope so you could
complete through the shortened names. I ended up instead going
through and refactoring the analyzer.
There are a few new utilities which would likely be useful for
anyone using them.
First up, semanticdb-ref.el manages references between semantic
databases (via #include style statements.) This is the key component
to the next set of caches which allow a file which is reparse to flush
caches on dependent files.
Next, semanticdb-find.el has a cache for the list of all files
dependent on, such as the list of include statements. A typical
analysis will request the list of includes several times, so the cache
will prevent all that extra work from happening. (Saving a whopping
.02 seconds or so.)
semanticdb-typecache.el is the next big change. This manages a
cache of all the datatypes you can get to from a given file (excluding
scoped types.) The analyzer used to do a search, and then merge all
similarly named namespaces together. This is now the job of the
The typecache can take a good 10 to 15 seconds to build the first
time in a particularly large source-code base (like the one I have at
work.) Once all the files are parsed, a refresh takes only 1 second
or so. (All on my Linux Opteron with perhaps 300 or so includes found
via a recursive search.) The typecache has a search function on it
that can then find a symbol, such as foo::bar very fast. If you have
an application that needs to lookup datatypes, then this is the API
There is a scope manager as well in semantic-scope.el. The analyzer
used to build the scope and store it itself. The scope manage will
calculate the scope, and can cache it between runs of semantic, which
can save a small fraction of a second. Additionally, the scope is now
available to applications. The information is pretty good, and I was
thinking it would be cool to highlight names that are in scope in some
way, though I haven't gotten that far.
Lastly, the analyzer was split in three parts. One is a set of
utility functions in semantic-analyze-fcn.el, then the core
semantic-analyze.el, and the analyzer-complete.el. The core analyzer
hasn't really changed, except to support using statements which mostly
happened in cedet/semantic/bovine/semantic-c.el.
As far as the raw speed of the smart completion utilities, you will
find that the first time, it will be a little slower as it builds up
all these caches. After that, it seemed about the same to me, having
shaved off only a fraction of a second, which makes me a little sad.
On the good side, the code is better organized, and it is just a
matter of profiling it and fixing the big-ticket slow items. I'm sure
there are some optimizations hiding in there that will now be easier
I would be encouraged for anyone who would try out the new
implementation for correctness on your code-bases and let me know how
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org