[Nepomuk] Review Request: kinotify: Conserve memory by only storing a file name once

Vishesh Handa me at vhanda.in
Sun Dec 2 17:57:14 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107556/
-----------------------------------------------------------

(Updated Dec. 2, 2012, 5:57 p.m.)


Review request for Nepomuk, Sebastian Trueg and Simeon Bird.


Changes
-------

Uploaded the wrong diff.


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 (updated)
-----

  services/filewatch/kinotify.cpp e540f76 
  services/filewatch/optimizedbytearray.h PRE-CREATION 

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/416749ce/attachment.html>


More information about the Nepomuk mailing list