kcalc > KCalcButton::paintEvent mallocs more than 80 MB per minute
Marius P
nmariusp1 at gmail.com
Mon May 30 03:35:46 BST 2022
Hello,
Would an improvement for the issue below. Constitute material for the KDE
Eco initiative?
If so, I am a senior C++ developer. I do not know Qt. I have more than 2
hours per week to dedicate to the issue below. I will need help.
The ideal situation would be to not do custom painting.
Technical details:
As per
https://blogs.gnome.org/chergert/2020/03/15/how-to-use-sysprof-to-part-ii/
chapter "Reducing Memory Allocations". kcalc in
https://invent.kde.org/utilities/kcalc/-/blob/master/kcalc_button.cpp#L133
for each button, does custom painting. mallocs e.g. in QTextDocument ctor
and in QTextDocument::setHtml(). The button's custom painting method uses
HTML mainly for center aligning/justifying text.
ALLOCATED TOTAL FUNCTION
[ 81.1 MiB] [ 69.04%]
KCalcButton::paintEvent(QPaintEvent*)
[ 23.7 MiB] [ 20.20%]
QTextDocument::QTextDocument(QObject*)
[ 15.7 MiB] [ 13.35%]
QTextDocument::setHtml(QString const&)
[ 12.0 MiB] [ 10.21%]
QTextDocument::size() const
[ 10.3 MiB] [ 8.74%] In file
/usr/lib/x86_64-linux-gnu/qt5/plugins/styles/breeze.so
[ 6.6 MiB] [ 5.59%]
QTextDocumentLayout::draw(QPainter*,
QAbstractTextDocumentLayout::PaintContext const&)
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-eco-discuss/attachments/20220530/a8d864bc/attachment.htm>
More information about the Kde-eco-discuss
mailing list