Bennett Helm a écrit :
generate a report with those data.) Nonetheless, what's obvious from that is the amount of time spent in QPainter (see, e.g., near the top and near the bottom; for the latter, the 1710.0 ms is for the whole tree, but of that QPainter takes up 1695.7 ms), font_metrics::width(char const*, unsigned long, LyXFont const&), font_metrics::width(char, LyXFont const&), and QImage::copy(int, int, int, int) const.

I see three things of importance:

+ 1144.3 ms QWorkArea::paintEvent(QPaintEvent*) (lyx)
|   1075.4 ms QPainter::drawPixmap(QRect const&, QPixmap const&,

This was a 30 seconds test right? I think this is acceptable for now.

+ 7835.1 ms > BufferView::Pimpl::update(Update::flags) (lyx)
| + 6709.7 ms LyXScreen::redraw(BufferView&, ViewMetricsInfo const&)
| | + 2974.5 ms QWorkArea::update(int, int, int, int) (lyx)
| | | + 2420.5 ms QPainter::drawImage(int, int, QImage const&, int, int,
| | |   479.4 ms QImage::copy(int, int, int, int)
| | + 3732.1 ms paintText(BufferView const&, ViewMetricsInfo const&) | | | | | + 1043.9 ms LyXText::redoParagraph(int) (lyx)
| | | | + 510.6 ms LyXText::rowBreakPoint(int, Row&) const (lyx)
| | | | | + 457.7 ms font_metrics::width(char, LyXFont const&) (lyx)
| | | | + 2417.1 ms ::RowPainter::paintFromPos(int&) (lyx)
| | | | | + 2394.6 ms ::RowPainter::paintChars(int&, LyXFont, bool,
| | | | | | + 524.7 ms font_metrics::width(char const*, unsigned long,
| | | | | | + 1825.8 ms QLPainter::text(int, int, std::basic_string<
| | | | | | | + 1824.8 ms QLPainter::text(int, int, char const*,
| | | | | | | | - 1710.0 ms QPainter::drawText(int, int, QString const&,

OK, this means that this "drawImage" should definitely not be in the update routine. I'll see to it but the slowest part of "LyXScreen::redraw" is not in there but in "paintText()" or more exactly in "font_metrics::width" and in QPainter::drawText. I am afraid there is not much I can do about that, it is Qt4 API. I'll google a bit to see if there's some solution to that drawText slowness. It seems that font_metrics::width is called two times within LyXText::redoParagraph, once in LyXText::rowBreakPoint and another in ::RowPainter::paintChars; I think this could be optimized out, Martin?


+ 1107.4 ms TransManager::translateAndInsert(char, LyXText*) (lyx)
| + 1105.4 ms TransManager::insert(std::basic_string<char,
| | + 1101.2 ms TransManager::insertVerbatim(std::basic_string<char, | | | | | + 1101.2 ms LyXText::insertChar(LCursor&, char) (lyx) | | | | + 1079.6 ms LyXText::setCursor(LCursor&, int, int, bool, bool) | | | | | | + 1077.6 ms LyXText::setCursorIntern(LCursor&, int, int, bool, | | | | | | + 1077.6 ms LCursor::setTargetX() (lyx)
| | | | | | | + 725.0 ms LyXText::redoParagraph(int) (lyx)
| | | | | | | + 362.9 ms LyXText::rowBreakPoint(int, Row&) const (lyx)

I am not sure all this is necessary for a single key press. I reckon there is a lot of room for optimization here.

Again, let me know if you want something different (or more of the same).

This one seems very useful Bennett, thanks!
More of the same with the other use cases would be perfect.

Abdel.

Reply via email to