Proposal to introduce a KDE::stringCache

Dr. Juergen Pfennig info at j-pfennig.de
Thu Feb 26 20:11:33 CET 2004


In reply to Marksim Orlovich ...

> >   This morning kde-core-devel had some discussion about memory
> > consumption by kfm when reading very large folders (there was actually an
> > out-of-memory problem). The thread-starter said that each file entry uses
> > 600 bytes.
>
> First of all, it's not really konqueror's normal views that were
> discussed, but rather a very fancy graphical view widget. So the
> measurements are not relevant for this particular technique

Ah! But I did my calculation based on Konqueror's normal views. See 
UDSEntryList.

> >   When a KDE app starts it is likely that a kdDebug or kdWarning causes
> > the kdebugrc file to be loaded. That file often contains tens of entries
> > like:
>
> Not in a release build, no?

Unfortunately also in a realease build - but the example is not so terribly 
good. Maybe other config files contain lots of sharable strings too. I have 
written a new config parser (to come soon) - I will run a few benchmarks 
(with string sharing). Anyhow I got shocked when I compared the time that the 
parser needs to parse all KDE config files (25.000 in a few seconds) to a the 
time that QT needs to store the parsed data into a simple object model 
(memory and time both have a factor of 10).

> Please see KGlobal::staticQString() in kdelibs;

Is not documented. Docu says: DO NOT USE. I agree - no static strings please!

> or what matches 
> your design much closer, StringShare in JuK  (GPLd, though, since I stole
> the hash from Qt).

Good. I will look at it soon.

> It should be easy enough  to share the user + group 
> strings like that. What's a bit trickier is that  the path name is hidden
> inside the URL, and it is the bit that is the most  likely to be shared
> between instances. Of course, file names should not go
> through such a cache, since they're likely to be unique. And, of course,
> measuring stuff is also important...

This is all correct. In the kio slave case only user and group would be 
shared.

Yours Jürgen


More information about the Kde-optimize mailing list