KDE/kdevplatform/language/duchain

David Nolden zwabel at googlemail.com
Fri Jul 18 12:52:37 UTC 2008


Am Freitag, 18. Juli 2008 14:35:09 schrieb Kris Wong:
> Do the repos really needed to be created statically?  My initial
> implementation of this did not use any statics.
>
> Kris Wong

Well, logically they are static objects(You have exactly one, you need it from 
the beginning), so why shouldn't we use that facility of C++, instead of 
working around it?

The current implementation doesn't have much in common with your initial one. 
The repositories assign indices to shared items, for example to 
strings(IndexedString) or to types(TypeSystem). That is leveraged in many 
places by statically asking the repository for an index while initialization, 
for example the index of an "empty" identifier, and from then on that empty 
identifier index is used when initializing the index of identifiers, instead 
of having to touch the repository whenever creating a new identifier.

Similar things are used in the C++ parser, for example it statically allocates 
an indexed string for "__declspec" or such things, and from then on it only 
has to compare the index, instead of looking anything up in the repository or 
processing a string to do comparison, so it's a large speedup there.

@Hamish:
Why should those static objects hurt KDevelop? We just need to make sure that 
the initialization order is ok. But since the basic repository registry is in 
a static function, it's already made sure that the initialization order is 
ok. So the only problem is that it's initialized that early that we cannot 
use KLockFile.

@apaku: Ah, then I'll try that SkipMainComponentRegistration thing.

Greetings, David




More information about the KDevelop-devel mailing list