From: Joachim E. <Joa...@gm...> - 2015-01-12 19:08:45
|
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> <div>Hi Maurice,</div> <div>Thank you for this enlightning analysis.</div> <div> </div> <div>Too many calls to loadGlyph is indeed bad for performance.</div> <div>In method getMaxTextWidth I took care to create only only instance of QTextLayout, because otherwise one call to loadGlyph would happen per line.</div> <div> </div> <div>Normally glyphs are cached, so there is no need to load them again and again.</div> <div>Perhaps you could compare different encodings too (cp1252 vs. utf8)?</div> <div>(I assume the typeset is latin mostly.)</div> <div> </div> <div>Best regards,</div> <div>Joachim</div> <div> <div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);"> <div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Sonntag, 11. Januar 2015 um 01:26 Uhr<br/> <b>Von:</b> "Maurice van der Pot" <gri...@kf...><br/> <b>An:</b> kdi...@li...<br/> <b>Betreff:</b> Re: [Kdiff3-user] kdiff3 consumes 100% cpu, seems hung</div> <div>On Mon, Jan 05, 2015 at 06:15:06PM +0100, Joachim Eibl wrote:<br/> > I suppose this is an effect of KDiff3-0.9.98 trying to analyze line<br/> > lengths for variable width fonts, where each character has to be analyzed.<br/> > If KDiff3 becomes responsive again after a long wait and only for long<br/> > files then that is the reason.<br/> <br/> Looking at the callgrind output the time is being spent in 1.9M calls of<br/> QFontEngineFT::loadGlyph (for reference, on my machine that function is<br/> only called 358 times).<br/> <br/> There are cases where this function is called while<br/> DiffTextWindow::prepareTextLayout is on the call stack, but I find it hard<br/> to tell why the loadGlyph function would be called so often.<br/> prepareTextLayout is called 32K times in his profile and 31K times in<br/> mine.<br/> <br/> #0 QFontEngineFT::loadGlyph (this=this@entry=0x1158040, set=set@entry=0x1158128, glyph=2, subPixelPosition=subPixelPosition@entry=..., format=format@entry=QFontEngine::Format_None, fetchMetricsOnly=fetchMetricsOnly@entry=true)<br/> at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qfontengine_ft.cpp:816<br/> #1 0x00007ffff75fbf03 in loadGlyph (fetchMetricsOnly=true, format=QFontEngine::Format_None, subPixelPosition=..., glyph=<optimized out>, this=0x1158040) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qfontengine_ft_p.h:281<br/> #2 QFontEngineFT::recalcAdvances (this=0x1158040, glyphs=0x7fffffffac98, flags=...) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qfontengine_ft.cpp:1611<br/> #3 0x00007ffff7528052 in hb_getAdvances (font=<optimized out>, glyphs=0x115f320, numGlyphs=61, advances=0x115f4a0, flags=<optimized out>) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qfontengine.cpp:105<br/> #4 0x00007ffff6d4b0f6 in HB_HeuristicPosition (item=item@entry=0x7fffffffb030) at /var/tmp/portage/dev-qt/qtcore-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp:441<br/> #5 0x00007ffff6d4cfff in HB_BasicShape (shaper_item=0x7fffffffb030) at /var/tmp/portage/dev-qt/qtcore-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp:624<br/> #6 0x00007ffff6d51c03 in HB_ShapeItem (shaper_item=0x7fffffffb030) at /var/tmp/portage/dev-qt/qtcore-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp:1419<br/> #7 0x00007ffff7559b20 in QTextEngine::shapeTextWithHarfbuzz (this=this@entry=0x115d270, item=item@entry=0) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qtextengine.cpp:1342<br/> #8 0x00007ffff755a4b2 in QTextEngine::shapeText (this=this@entry=0x115d270, item=item@entry=0) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qtextengine.cpp:935<br/> #9 0x00007ffff755a7d5 in QTextEngine::shape (this=this@entry=0x115d270, item=item@entry=0) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qtextengine.cpp:1450<br/> #10 0x00007ffff756bbaf in QTextLine::layout_helper (this=this@entry=0x7fffffffb970, maxGlyphs=maxGlyphs@entry=2147483647) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qtextlayout.cpp:1761<br/> #11 0x00007ffff756cb9e in QTextLine::setNumColumns (this=this@entry=0x7fffffffb970, numColumns=numColumns@entry=2147483647) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qtextlayout.cpp:1550<br/> #12 0x00007ffff756cc05 in QTextLayout::endLayout (this=0x7fffffffba90) at /var/tmp/portage/dev-qt/qtgui-4.8.6-r1/work/qt-everywhere-opensource-src-4.8.6/src/gui/text/qtextlayout.cpp:644<br/> #13 0x0000000000431235 in DiffTextWindowData::prepareTextLayout (this=0x1115380, textLayout=..., visibleTextWidth=-1) at difftextwindow.cpp:870<br/> #14 0x000000000042ee37 in DiffTextWindow::getMaxTextWidth (this=0x110f0d0) at difftextwindow.cpp:341<br/> #15 0x0000000000476f8c in KDiff3App::setHScrollBarRange (this=0x8450b0) at pdiff.cpp:428<br/> #16 0x000000000047733a in KDiff3App::resizeDiffTextWindowHeight (this=0x8450b0, newHeight=57) at pdiff.cpp:471<br/> <br/> What do you think?<br/> <br/> Regards,<br/> Maurice.<br/> <br/> --<br/> Maurice van der Pot<br/> <br/> Kdiff3 developer gri...@kf... <a href="http://kdiff3.sourceforge.net" target="_blank">http://kdiff3.sourceforge.net</a><br/> <br/> ------------------------------------------------------------------------------<br/> Dive into the World of Parallel Programming! The Go Parallel Website,<br/> sponsored by Intel and developed in partnership with Slashdot Media, is your<br/> hub for all things parallel software development, from weekly thought<br/> leadership blogs to news, videos, case studies, tutorials and more. Take a<br/> look and join the conversation now. <a href="http://goparallel.sourceforge.net" target="_blank">http://goparallel.sourceforge.net</a>_______________________________________________<br/> Kdiff3-user mailing list<br/> Kdi...@li...<br/> <a href="https://lists.sourceforge.net/lists/listinfo/kdiff3-user" target="_blank">https://lists.sourceforge.net/lists/listinfo/kdiff3-user</a></div> </div> </div> </div></div></body></html> |