Review Request 122487: Reorder member variables to reduce memory usage.

David Faure faure at kde.org
Sun Feb 8 20:45:44 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/122487/#review75629
-----------------------------------------------------------

Ship it!


Which magic tool did you come up with this time, to detect such things? :-)

- David Faure


On Feb. 8, 2015, 8:28 p.m., Volker Krause wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122487/
> -----------------------------------------------------------
> 
> (Updated Feb. 8, 2015, 8:28 p.m.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: kcoreaddons
> 
> 
> Description
> -------
> 
> The KJobPrivate one saves 24 bytes per instance, the others 8 bytes (on a 64 bit system).
> 
> 
> Diffs
> -----
> 
>   src/lib/io/kdirwatch_p.h f8cc2bcd5b9a8c65b409873ac78455fbb7db2405 
>   src/lib/jobs/kjob.cpp de3b8d7c8985dcc21ef9f52fba47361e9675f192 
>   src/lib/jobs/kjob_p.h 8bacefecc4dc8d2679a48b224837e0c01516d601 
>   src/lib/plugin/kpluginloader.cpp 64d7f0cec37ef51a76a3a60637822810cab398e6 
> 
> Diff: https://git.reviewboard.kde.org/r/122487/diff/
> 
> 
> Testing
> -------
> 
> ```
> Struct "Entry (DW_TAG_class_type, offset 393887)" is sub-optimally packed: 74/88 bytes, 592/704 bits, optimal size is: 80 bytes
> class KDirWatchPrivate::Entry // location: /k/kde5/src/kcoreaddons/src/lib/io/kdirwatch_p.h:83
> {
>     time_t m_ctime; // member offset: 0, size: 8, alignment: 8
>     int m_nlink; // member offset: 8, size: 4, alignment: 4
>     // 4 byte(s) padding
>     ino_t m_ino; // member offset: 16, size: 8, alignment: 8
>     entryStatus m_status; // member offset: 24, size: 4, alignment: 4
>     entryMode m_mode; // member offset: 28, size: 4, alignment: 4
>     bool isDir; // member offset: 32, size: 1, alignment: 1
>     // 7 byte(s) padding
>     QList<KDirWatchPrivate::Client*> m_clients; // member offset: 40, size: 8, alignment: 8
>     QList<KDirWatchPrivate::Entry*> m_entries; // member offset: 48, size: 8, alignment: 8
>     QString path; // member offset: 56, size: 8, alignment: 8
>     int msecLeft; // member offset: 64, size: 4, alignment: 4
>     int freq; // member offset: 68, size: 4, alignment: 4
>     bool dirty; // member offset: 72, size: 1, alignment: 1
>     // 3 byte(s) padding
>     int wd; // member offset: 76, size: 4, alignment: 4
>     QList<QString> m_pendingFileChanges; // member offset: 80, size: 8, alignment: 8
> }; // size: 88, alignment: 8
> 
> Struct "KJobPrivate (DW_TAG_class_type, offset 1112242)" is sub-optimally packed: 95/120 bytes, 760/960 bits, optimal size is: 96 bytes
> class KJobPrivate // location: /k/kde5/src/kcoreaddons/src/lib/jobs/kjob_p.h:36
> {
>     __vtbl_ptr_type* _vptr.KJobPrivate; // member offset: 0, size: 8, alignment: 8
>     KJob* q_ptr; // member offset: 8, size: 8, alignment: 8
>     KJobUiDelegate* uiDelegate; // member offset: 16, size: 8, alignment: 8
>     int error; // member offset: 24, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QString errorText; // member offset: 32, size: 8, alignment: 8
>     Unit progressUnit; // member offset: 40, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QMap<KJob::Unit, long long unsigned int> processedAmount; // member offset: 48, size: 8, alignment: 8
>     QMap<KJob::Unit, long long unsigned int> totalAmount; // member offset: 56, size: 8, alignment: 8
>     long unsigned int percentage; // member offset: 64, size: 8, alignment: 8
>     bool suspended; // member offset: 72, size: 1, alignment: 1
>     // 3 byte(s) padding
>     Capabilities capabilities; // member offset: 76, size: 4, alignment: 4
>     QTimer* speedTimer; // member offset: 80, size: 8, alignment: 8
>     bool isAutoDelete; // member offset: 88, size: 1, alignment: 1
>     // 7 byte(s) padding
>     QEventLoop* eventLoop; // member offset: 96, size: 8, alignment: 8
>     QEventLoopLocker eventLoopLocker; // member offset: 104, size: 8, alignment: 8
>     bool isFinished; // member offset: 112, size: 1, alignment: 1
>     // 7 byte(s) padding
> }; // size: 120, alignment: 8
> 
> Struct "KPluginLoaderPrivate (DW_TAG_class_type, offset 1584914)" is sub-optimally packed: 37/48 bytes, 296/384 bits, optimal size is: 40 bytes
> class KPluginLoaderPrivate // location: /k/kde5/src/kcoreaddons/src/lib/plugin/kpluginloader.cpp:37
> {
>     KPluginLoader* q_ptr; // member offset: 0, size: 8, alignment: 8
>     QString const name; // member offset: 8, size: 8, alignment: 8
>     quint32 pluginVersion; // member offset: 16, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QString errorString; // member offset: 24, size: 8, alignment: 8
>     bool pluginVersionResolved; // member offset: 32, size: 1, alignment: 1
>     // 7 byte(s) padding
>     QPluginLoader* loader; // member offset: 40, size: 8, alignment: 8
> }; // size: 48, alignment: 8
> ```
> 
> 
> Thanks,
> 
> Volker Krause
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150208/6aa3ba88/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list