Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-19728

Performance: QDeclarativeText does unnecessary layout steps for RichText

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.0.0
    • 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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            mikkohar Mikko Harju
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes