Le 31/12/2016 à 15:24, Jean-Marc Lasgouttes a écrit :
It is this particular patch. I amended it since the initial July 5
creattion, but apparently git does not update date by default.
To be more precise, this is the commit below, pushed on Dec 19. I have
prepared a version for stable (for discussion), that I will post later.
JMarc
commit c5119c97fcf84e8dd2cfcdd605cc0a9ffa8b5bc4
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Tue Jul 5 14:06:22 2016 +0200
Add caching for the QTextLayout objects we use
The QTextLayout handling is terribly slow on Qt 4.8.7, but some
caching has been added in Qt5 that makes it much faster. For some
reason, it is not that slow with Qt 4.8.1.
Caches are introduced for the three following methods
* width(doctring), controlled by CACHE_METRICS_WIDTH. This cache
already
existed, but the code has been cleaned up
* getTextLayout, controlled by CACHE_METRICS_QTEXTLAYOUT (disabled by
default on Qt5, which does its own caching). This is used for pos2x
and x2pos and now for drawing of text too. The previous code used a
trivial caching scheme of the last used QTextLayout, but now they
are properly kept in a QCache. Moreover, the cacheEnabled() property
is enabled for these QTextLayout object (not sure what this does).
* breakAt, controlled by CACHE_METRICS_BREAKAT. This is the only user
of QTextLayout which did not have some kind of caching already.
For some weird reasons related to Argument-dependent look-up, the
qHash(docstring) function has to be defined in std namespace, since
lyx::docstring is actually std::basic_string<wchar_t>.
[NOTE: this version has profiling hooks, enabled by commenting out
the line
#define DISABLE_PMPROF
that should eventually be removed.]