[Nepomuk] Review Request: kinotify: Conserve memory by only storing a file name once
Vishesh Handa
me at vhanda.in
Sun Dec 2 17:55:29 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107556/
-----------------------------------------------------------
Review request for Nepomuk, Sebastian Trueg and Simeon Bird.
Description
-------
kinotify: Conserve memory by only storing a file name once
We need to map each url to its watch descriptor. This is done via a
QHash<QByteArray, int>. Since the byte arrays over here are file urls,
they share common prefixes.
Example - '/home/vishesh' and '/home/vishesh/Documents'.
Instead of storing each one separately, we split the byte array, and
store it in a vector ['home', 'vishesh'] and ['home', 'vishesh',
'Documents']. Additionally, we make sure only one copy of each string
exists. This is done automatically by Qt's reference counted containers.
Diffs
-----
services/filewatch/kinotify.cpp e540f76
Diff: http://git.reviewboard.kde.org/r/107556/diff/
Testing
-------
Memory usage decreased from 20.3 to 18.2 mb. So we save about 2mb. It's not much, but it could be a LOT more based on the user's filesystem.
Thanks,
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20121202/6fca959f/attachment.html>
More information about the Nepomuk
mailing list