Jean-Marc Lasgouttes wrote: >>>>>> "Peter" == Peter Kümmel <[EMAIL PROTECTED]> writes: > > Peter> So optimizing the text drawing functions couldn't more than > Peter> doubling the speed. > > On LyX/Mac, the other half is taken by QLFontInfo::width. You may want > to experiment with USE_LYX_FONTCACHE in qfont_loader.h to see whether > our caching helps (it would be nice to know why it is useful too). > > JMarc > >
Here the results with enabled and disabled USE_LYX_FONTCACHE: (Qt 4.1.3, msvc, debug) I've normalized the measured times to the maximum value: - USE_LYX_FONTCACHE enabled Normalized used time in % QLFontInfo::width................................. : 100 QLPainter::fillrectangle.......................... : 10 QLPainter::line................................... : 1 QLPainter::setQPainterPen......................... : 7 QPainter::drawText in QLPainter................... : 48 qfont_metrics.C::ascent........................... : 1 qfont_metrics.C::descent.......................... : 1 qfont_metrics.C::maxDescent....................... : 2 qfont_metrics.C::minDescent....................... : 2 qfont_metrics.C::signedWidth...................... : 15 - USE_LYX_FONTCACHE disabled Normalized used time in % QLFontInfo::width................................. : 100 QLPainter::fillrectangle.......................... : 10 QLPainter::line................................... : 1 QLPainter::setQPainterPen......................... : 9 QPainter::drawText in QLPainter................... : 47 qfont_metrics.C::descent.......................... : 1 qfont_metrics.C::maxDescent....................... : 2 qfont_metrics.C::minDescent....................... : 2 qfont_metrics.C::signedWidth...................... : 15 With enabled USE_LYX_FONTCACHE it is a little bit faster (because the value of QLFontInfo::width becomes smaller compared to the others: enabled 100<->48, disabled 100<->47) I wonder that the width function takes so much time? I'll recheck my profiling code, also I will recompile LyX with enabled optimizations. Peter