Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
4.7.3
-
None
-
Ubuntu 10.10, Qt git sha b2d19aef5e0bd836e41cde7860dcb315432682b8
Description
When creating a QDeclarativeText component with Text.RichText format, initializations cause unnecessary layouts to be carried out (for example, setting default font for the document causes a relayout).
At least part of the work can be avoided by setting the page size of the document to QSizeF(0,0) in QDeclarativeTextPrivate::ensureDoc() because QTextDocumentLayout::documentChanged checks for the page size and skips layout if it isNull(). The proper size will be eventually set in the QDeclarativeTextPrivate::updateSize().
Patched tests/benchmarks/declarative/qdeclarativecomponent shows about 50% reduction in component creation time for rich text items.
Before:
RESULT : tst_qmlcomponent::creation():"RichTextLabel":
0.67 msecs per iteration (total: 86, iterations: 128)
After:
RESULT : tst_qmlcomponent::creation():"RichTextLabel":
0.29 msecs per iteration (total: 75, iterations: 256)
Attachments
For Gerrit Dashboard: QTBUG-19728 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
30127,1 | Speed up Text construction with RichText | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |