The future of gideon

Bernd Gehrmann Bernd-Gehrmann at gmx.de
Thu May 30 10:48:46 UTC 2002


On Wednesday 29 May 2002 22:39, you wrote:

> 2nd is the storing of all the information we collect. working with
> pre-parsed qt / kde - headers is not that slow as i expected, but
> completing a class with lots of parents takes its time.

What takes time? Finding out the type of the completed symbol, or
collecting its members? The former should not depend on the number
of parents, and the latter should be infinitely fast AFAICT. Except if
your system is heavily swapping under the weight of the preparsed
class store.

> again, i don't know
> it exactly but is the currently used approach the fastest solution (for
> dealing with big projects; maybe with hundreds of own classes ?) or should
> a real database be considered ?

I don't know how much memory large projects really take, but I'm pretty sure
we can cut down memory usage by a factor 2 without too much effort.
For example:

- for library classes, private members can be thrown away
- for library classes, the definedInFile and declaredInFile strings
  can be discarded
- A lot of memory is wasted when the class store is written to a file
  and then read back. For example,

    QString definedInFile = "/some/long/path";
    QString declaredInFile = definedInFile;
    // at this point, both strings are implicitly shared by QString
    stream << definedInFile << declaredInFile;
    stream >> definedInFile >> declaredInFile;
    // at this point, the strings are not shared anymore

  I assume this to be a drastic source of bloat in particular for methods,
  which are represented by the ParsedMethod class which in turn inherits
  ParsedItem. One way to reduce this would be a method ClassStore::saveMemory()
  which is called after the class store is restored and which iterates over all
  classes and methods and does something like

    if (parsedMethod->declaredInFile == parsedClass->declaredInFile)
      parsedMethod->declaredInFile = parsedClass->declaredInFile;

- the iterators in ParsedClass and ParsedScopeContainer are unnecessary. Iterators
  can always be created on-the-fly. The QDictIterators are essentially a legacy of
  Qt 1 times, when returning a QDict by value was very costly; nowadays we 
  have QMap which is implicitly shared.

Bernd.





More information about the KDevelop-devel mailing list