[Kde-pim] Review Request 110300: Save memory by sharing data object of empty KABC::Picture objects

Milian Wolff mail at milianw.de
Sat May 4 18:31:41 BST 2013


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

(Updated May 4, 2013, 5:31 p.m.)


Review request for KDEPIM-Libraries.


Changes
-------

ups, wrong patch :)


Description
-------

Optimize memory consumption of KABC library for large address books.
In many cases no picture will be set for a contact yet still Picture::Private
was allocated. On my 64bit machine it has a size of 64bytes.

A common practice is to share the data member for empty objects, as is done
in most Qt classes (QString e.g.). This then saves the Picture::Private
allocation for all contacts which do not have any picture set.

Implementation detail: Sadly one cannot make it work with a private Private
class as that would not be accessible by the Q_GLOBAL_STATIC helper. Renaming
the private data class should not have any affect on the ABI though.


Diffs (updated)
-----

  kabc/picture.h d76d0da 
  kabc/picture.cpp 02010a2 

Diff: http://git.reviewboard.kde.org/r/110300/diff/


Testing
-------


Thanks,

Milian Wolff

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list