Le 27/05/2016 23:08, Guillaume Munch a écrit :
The protocol is to change the width of the window (all other things equal).

Qt4: 75% of the time is spent (in number of instructions) inside
QTextEngine::shapeText(). Of these 75%, 2/3 is requested by metrics
calculation (QTextLine::setLineWidth() from GuiFontMetrics::breakAt())
and 1/3 by painting (GuiPainter::text()). Ultimately, 74% of the time
is spent in in FT_Load_Glyph and FT_Render_Glyph from
libfreetype.so.6.12.1 (thus, including the metrics phase).

At some time, I had the idea of caching the QTextLine object in the row element. I suspect this would be a good thing to do.

Qt5: QTextEngine::shapeText() only accounts for 13.22% of the cycles,
and costs 28 times less per call (69729 instructions vs 1932642).
QTextLine::setLineWidth() only costs 4% total. GuiPainter::text() costs
21%, with time spent in a certain QRasterPaintEngine::drawCachedGlyphs().

This difference is very surprising, there has to be something that is different.

Conclusion: using QTextLine::setLineWidth() breaking rows is very costly
with qt4.8.7, and much less with qt5. I agree with you that I do not
remember seeing this slowness before, and I do not know what exactly
could trigger this behaviour.

I have to double-check, but this seems indeed slower now than it used to be. What is your OS?

What tool did you use to assess performance?

JMarc

Reply via email to