qt5base-lts/tests/benchmarks/gui
Milian Wolff 0102f34f1e Optimize QTextLayout/QTextEngine usage outside of QTextDocument.
When QTextLayout is used in a QTextDocument, many code paths use
special caches and thus greatly outperform the raw QTextLayout version
that operates directly on a QString.

This patch brings some of these optimizations also to the raw version.
We now also use a QFormatCollection in such cases and enable the
functionality of QTextEngine::indexAdditionalFormats() and
QTextEngine::resolveAdditionalFormats(). Thanks to that, we can greatly
speed up QTextEngine::format(), which now uses an amort O(1) hash table
lookup instead of a O(N) linear search.

The added benchmark shows a gain in the order of one magnitude:

./tst_bench_QText formattedLayout:long-many

before applying the patch:
378.19 msecs per iteration (total: 37,820, iterations: 100)
after applying the patch:
25.80 msecs per iteration (total: 2,580, iterations: 100)

Note: This change is source-incompatible for applications using the private
QTextEngine API.

Task-number: QTBUG-8389
Change-Id: Ifcf7a8902a394428979ea06a6d955f886ee739c7
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-09-05 03:02:59 +02:00
..
animation Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
graphicsview Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
image Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
itemviews Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
kernel Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
math3d Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
painting Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
styles Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
text Optimize QTextLayout/QTextEngine usage outside of QTextDocument. 2012-09-05 03:02:59 +02:00
gui.pro Make benchmarks compile without QtWidgets 2012-07-30 10:43:50 +02:00