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

Laurent Montel montel at kde.org
Fri Apr 17 07:31:02 UTC 2015



> On avr. 16, 2015, 8:43 après-midi, Laurent Montel wrote:
> > Hi volker
> > What did you use as program to detect it ?
> > Thanks for info.
> 
> Volker Krause wrote:
>     The tool is called "elf-packcheck", part of kde:scratch/vkrause/elf-dissector, and still in development. I'm using KF5 as testing ground, the run on widgetaddons yesterday showed only one bug resulting in wrong numbers, so if one doesn't blindly trust the output it's getting usable for finding unnecessary padding. But as the above output shows, there is still lots of work to be done on the optimizer to handle bitfield packing.

Ah great.
Where did you find Iberty package for opensuse ? I found a very old package and it doesn't find some enum as DEMANGLE_COMPONENT_REFERENCE_THIS etc.


- Laurent


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


On avr. 16, 2015, 7:53 après-midi, Volker Krause wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123390/
> -----------------------------------------------------------
> 
> (Updated avr. 16, 2015, 7:53 après-midi)
> 
> 
> Review request for KDE Frameworks and Christoph Feck.
> 
> 
> Repository: kwidgetsaddons
> 
> 
> Description
> -------
> 
> Saves 8 byte in all cases, on 64bit systems.
> 
> 
> Diffs
> -----
> 
>   src/kcapacitybar.cpp 5009208d0057933553245b1f007c9779b916bdf6 
>   src/kcolumnresizer.cpp 6316bff145c337d9f16ac33f1b8dadb168b67ab0 
>   src/kdatetable.cpp 495d64b91faf21b26dcee51131b8cf2c270b213f 
>   src/kfontchooser.cpp 16eecc42f20a733902bab00532610c1caee9ac3b 
>   src/kpassworddialog.cpp 2d05df2d1feb3f87751db104d6d64dc736c58e1a 
>   src/kratingpainter.cpp 624c3cb0a66b37e6ac250eaaffeae9604cfa6cc0 
> 
> Diff: https://git.reviewboard.kde.org/r/123390/diff/
> 
> 
> Testing
> -------
> 
> Used bytes: 37/48 (77.08%)
> Used bits: 290/384 (75.52%)
> Optimal size: 40 bytes (-8 bytes, 16.67%)
> class FormLayoutWidgetItem // location: /k/kde5/src/kwidgetsaddons/src/kcolumnresizer.cpp:30
> {
>     inherits QWidgetItem ; // member offset: 0, size: 24, alignment: 8
>     int m_width; // member offset: 24, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QFormLayout* m_formLayout; // member offset: 32, size: 8, alignment: 8
>     ItemRole m_itemRole; // member offset: 40, size: 4 (needed: 2 bits), alignment: 4
>     // 4 byte(s) padding
> }; // size: 48, alignment: 8
> 
> Used bytes: 82/96 (85.42%)
> Used bits: 642/768 (83.59%)
> Optimal size: 88 bytes (-8 bytes, 8.333%)
> class KDateTable::KDateTablePrivate // location: /k/kde5/src/kwidgetsaddons/src/kdatetable.cpp:35
> {
>     KDateTable* q; // member offset: 0, size: 8, alignment: 8
>     int fontsize; // member offset: 8, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QDate m_date; // member offset: 16, size: 8, alignment: 8
>     int m_weekDayFirstOfMonth; // member offset: 24, size: 4, alignment: 4
>     int m_numDaysThisMonth; // member offset: 28, size: 4, alignment: 4
>     QRectF m_maxCell; // member offset: 32, size: 32, alignment: 8
>     int m_numWeekRows; // member offset: 64, size: 4, alignment: 4
>     int m_numDayColumns; // member offset: 68, size: 4, alignment: 4
>     bool m_popupMenuEnabled; // member offset: 72, size: 1 (needed: 1 bits), alignment: 1
>     bool m_useCustomColors; // member offset: 73, size: 1 (needed: 1 bits), alignment: 1
>     // 6 byte(s) padding
>     QHash<int, KDateTable::KDateTablePrivate::DatePaintingMode> m_customPaintingModes; // member offset: 80, size: 8, alignment: 8
>     int m_hoveredPos; // member offset: 88, size: 4, alignment: 4
>     // 4 byte(s) padding
> }; // size: 96, alignment: 8
> 
> Used bytes: 189/200 (94.5%)
> Used bits: 1506/1600 (94.12%)
> Optimal size: 192 bytes (-8 bytes, 4%)
> class KFontChooser::Private // location: /k/kde5/src/kwidgetsaddons/src/kfontchooser.cpp:79
> {
>     KFontChooser* q; // member offset: 0, size: 8, alignment: 8
>     QPalette m_palette; // member offset: 8, size: 16, alignment: 8
>     bool signalsAllowed:1; // member offset: 24, size: 1 (needed: 1 bits), alignment: 1, bit offset: 7
>     bool usingFixed:1; // member offset: 24, size: 1 (needed: 1 bits), alignment: 1, bit offset: 6
>     // 7 byte(s) padding
>     QDoubleSpinBox* sizeOfFont; // member offset: 32, size: 8, alignment: 8
>     QTextEdit* sampleEdit; // member offset: 40, size: 8, alignment: 8
>     QLabel* familyLabel; // member offset: 48, size: 8, alignment: 8
>     QLabel* styleLabel; // member offset: 56, size: 8, alignment: 8
>     QCheckBox* familyCheckbox; // member offset: 64, size: 8, alignment: 8
>     QCheckBox* styleCheckbox; // member offset: 72, size: 8, alignment: 8
>     QCheckBox* sizeCheckbox; // member offset: 80, size: 8, alignment: 8
>     QLabel* sizeLabel; // member offset: 88, size: 8, alignment: 8
>     QListWidget* familyListBox; // member offset: 96, size: 8, alignment: 8
>     QListWidget* styleListBox; // member offset: 104, size: 8, alignment: 8
>     QListWidget* sizeListBox; // member offset: 112, size: 8, alignment: 8
>     QCheckBox* sizeIsRelativeCheckBox; // member offset: 120, size: 8, alignment: 8
>     QFont selFont; // member offset: 128, size: 16, alignment: 8
>     QString selectedStyle; // member offset: 144, size: 8, alignment: 8
>     qreal selectedSize; // member offset: 152, size: 8, alignment: 8
>     int customSizeRow; // member offset: 160, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QString standardSizeAtCustom; // member offset: 168, size: 8, alignment: 8
>     QHash<QString, QString> qtFamilies; // member offset: 176, size: 8, alignment: 8
>     QHash<QString, QString> qtStyles; // member offset: 184, size: 8, alignment: 8
>     QHash<QString, QString> styleIDs; // member offset: 192, size: 8, alignment: 8
> }; // size: 200, alignment: 8
> 
> Used bytes: 25/40 (62.5%)
> Used bits: 173/320 (54.06%)
> Optimal size: 32 bytes (-8 bytes, 20%)
> class KCapacityBar::Private // location: /k/kde5/src/kwidgetsaddons/src/kcapacitybar.cpp:43
> {
>     int value; // member offset: 0, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QString text; // member offset: 8, size: 8, alignment: 8
>     bool fillFullBlocks; // member offset: 16, size: 1 (needed: 1 bits), alignment: 1
>     bool continuous; // member offset: 17, size: 1 (needed: 1 bits), alignment: 1
>     // 2 byte(s) padding
>     int barHeight; // member offset: 20, size: 4, alignment: 4
>     Alignment horizontalTextAlignment; // member offset: 24, size: 4, alignment: 4
>     ControlElement ce_capacityBar; // member offset: 28, size: 4 (needed: 10 bits), alignment: 4
>     DrawTextMode drawTextMode; // member offset: 32, size: 4 (needed: 1 bits), alignment: 4
>     // 4 byte(s) padding
> }; // size: 40, alignment: 8
> 
> Used bytes: 176/184 (95.65%)
> Used bits: 1408/1472 (95.65%)
> Optimal size: 176 bytes (-8 bytes, 4.348%)
> class KPasswordDialog::KPasswordDialogPrivate // location: /k/kde5/src/kwidgetsaddons/src/kpassworddialog.cpp:36
> {
>     KPasswordDialog* q; // member offset: 0, size: 8, alignment: 8
>     KPasswordDialogFlags m_flags; // member offset: 8, size: 4, alignment: 4
>     // 4 byte(s) padding
>     Ui_KPasswordDialog ui; // member offset: 16, size: 136, alignment: 8
>     QMap<QString, QString> knownLogins; // member offset: 152, size: 8, alignment: 8
>     QComboBox* userEditCombo; // member offset: 160, size: 8, alignment: 8
>     QLabel* pixmapLabel; // member offset: 168, size: 8, alignment: 8
>     unsigned int commentRow; // member offset: 176, size: 4, alignment: 4
>     // 4 byte(s) padding
> }; // size: 184, alignment: 8
> 
> Used bytes: 55/72 (76.39%)
> Used bits: 420/576 (72.92%)
> Optimal size: 64 bytes (-8 bytes, 11.11%)
> class KRatingPainter::Private // location: /k/kde5/src/kwidgetsaddons/src/kratingpainter.cpp:30
> {
>     int maxRating; // member offset: 0, size: 4, alignment: 4
>     // 4 byte(s) padding
>     QIcon icon; // member offset: 8, size: 8, alignment: 8
>     bool isEnabled; // member offset: 16, size: 1 (needed: 1 bits), alignment: 1
>     bool bHalfSteps; // member offset: 17, size: 1 (needed: 1 bits), alignment: 1
>     // 2 byte(s) padding
>     Alignment alignment; // member offset: 20, size: 4, alignment: 4
>     LayoutDirection direction; // member offset: 24, size: 4 (needed: 2 bits), alignment: 4
>     // 4 byte(s) padding
>     QPixmap customPixmap; // member offset: 32, size: 32, alignment: 8
>     int spacing; // member offset: 64, size: 4, alignment: 4
>     // 4 byte(s) padding
> }; // size: 72, alignment: 8
> 
> 
> Thanks,
> 
> Volker Krause
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150417/13dbf0dd/attachment.html>


More information about the Kde-frameworks-devel mailing list