Go to file
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
bin de-duplicate code 2012-08-28 20:47:11 +02:00
config.tests mips: Autodetect MIPS DSP rev1 and rev2 instructionset 2012-09-01 15:28:24 +02:00
dist QStyle: make standardIcon() & layoutSpacing() virtual 2012-08-31 18:56:35 +02:00
doc Moved gui example documentation to the proper location. 2012-09-01 11:21:46 +02:00
examples Command-line-only examples should not build as .app bundles on OSX 2012-09-03 11:05:49 +02:00
lib Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
mkspecs QNX: Move qpa-based mkspecs out of the unsupported directory 2012-09-04 18:17:23 +02:00
qmake remove handling of QMAKE_FILETAGS 2012-09-03 19:39:02 +02:00
src Optimize QTextLayout/QTextEngine usage outside of QTextDocument. 2012-09-05 03:02:59 +02:00
tests Optimize QTextLayout/QTextEngine usage outside of QTextDocument. 2012-09-05 03:02:59 +02:00
tools configure: Fix infinite loop displaying config.summary 2012-09-03 13:41:55 +02:00
util Make plugintest util work on Windows. 2012-08-30 13:51:22 +02:00
.gitattributes Added .tag file with Git revision. 2011-05-03 16:23:49 +02:00
.gitignore Updated .gitignore 2012-08-18 13:59:11 +02:00
.tag Added .tag file with Git revision. 2011-05-03 16:23:49 +02:00
configure Rename MAC_CONFIG_TEST_COMMANDLINE to MAC_SDK_FLAG 2012-09-03 13:41:55 +02:00
configure.bat Remove Q_BYTE_ORDER and -*-endian arguments from configures 2012-03-02 14:48:00 +01:00
header.BSD Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.FDL Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.LGPL Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.LGPL-ONLY Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
INSTALL Remove Symbian specific code from qtbase. 2012-01-31 07:08:31 +01:00
LGPL_EXCEPTION.txt Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPL Add the LICENSE.GPL file to the module referenced from license headers 2012-05-20 22:41:08 +02:00
LICENSE.LGPL Update contact information in license headers. 2012-01-23 04:04:33 +01:00
LICENSE.PREVIEW.COMMERCIAL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
qtbase.pro Install right version of tools when x-compiling. 2012-07-17 12:52:48 +02:00
sync.profile Revert "Move QWindowSystemInterface out of qpa." 2012-08-03 00:38:09 +02:00