Skipping once in the data function is the clean way to do this. Saves
setting up dummy data just so as to skip it, or setting up real data
and then skippin on each row.
Change-Id: I1666d134b6f206e8055fbbc5efd2e2116431a9c1
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Support for buffered usage with QFSFileEngine was dropped in 5.10;
trying to use it triggers an assert.
Task-number: QTBUG-91713
Pick-to: 5.15 6.1 6.2
Change-Id: I5f46e9f793310538344b96bf2efbeba34098de83
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The benchmark had a hard-coded path on MS and needed an environment
variable set otherwise; neither sounds like a good approach, when
testlib defines a variable that tells us the test's source directory,
a clearly superior way to find things in our source directories.
In the process, replace exit()ing on failure to get a path with a
QSKIP() so that the test at least fails gracefully if it ever can't
find its data. (Using QFAIL() left it with no rows but still trying to
run the test, leading to an assert failure.)
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: I1bd5561971239bb838bcf6c24bcdf1d07c81a657
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
MyPrimitive has a copy ctor but lacked a copy assignment operator,
leading to above-mentioned warning.
Fix by supplying the missing special member function.
Change-Id: Icd0c3c12554eb838b5d880ec9a649d0b5cfc81b7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The benchmark simply calls the non-trivial methods of QFuture, mostly to
make sure that fixes in the parent patches don't have any performance
implications.
Task-number: QTBUG-92045
Change-Id: Ib4e8c314a70b3090a1af55f1b96d9dad4bc63861
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The change in 004e3e0dc2 introduces
Windows junction awareness, though users were still unable to resolve
the junction target. This change adds the ability to solve this.
Fixes: QTBUG-93869
Change-Id: I9f4d4ed87b92e757f7b6d8739e2a61b58c096f63
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Both functions now return a result object. Eliminates the need
to pass the errorMessage out-parameter. Adapt auto-tests.
Change-Id: I110b68fedc67b01f76796c44fa55383b2cc03460
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Mostly for testing QLatin1String::indexOf optimizations in the next
patch but useful in general
Change-Id: I85bf76f3e1d5abb994fd12907db2f2a723a8d330
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file. Before, BASE was merely prepended to every file that
got passed to qt_add_resources.
Old behavior:
qt_add_resources(app "images"
PREFIX "/"
BASE "../shared"
FILES "images/button.png")
Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.
New behavior:
qt_add_resources(app "images"
PREFIX "/"
BASE "../shared"
FILES "../shared/images/button.png")
The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment
is needed.
The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be
ported one by one to this new behavior. Then the old code path can be
removed.
Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Since these tests do not actually use the filename in the loops, add
macros to declare them unused.
Change-Id: I3362e0478ac6802b37f54f90ca377aa462570d8c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Use QBENCHMARK_ONCE rather than QBENCHMARK to avoid skewing the results:
when the QBENCHMARK block is repeated multiple times after the setup
code above runs once, only the first setFilterRegularExpression() call
unfilters some rows, while the subsequent calls simply check that there
is nothing to do.
The added benchmark is sensitive to the inefficiency - quadratic rather
than linear time complexity - fixed by
7d92ef63d7. The following two tables
contain the benchmark results on my GNU/Linux system. The numbers denote
milliseconds per iteration.
1. Qt 5.15.2 without the performance fix:
10K 25K 50K 100K 250K 500K
no match 0 1 2 5 14 28
all 0 0 0 1 3 7
first 0 1 2 5 14 28
1000th 2 6 12 25 68 302
middle 3 34 132 518 3300 13665
1000th from end 1 4 9 19 50 103
last 0 1 2 5 14 30
each 10'000th 0 39 211 937 6326 41050
each 100'000th 0 1 2 5 4226 34780
Without the fix the benchmark times out and aborts at 1000K and 2000K
data rows.
2. Qt 5.15.2 with the performance fix:
10K 25K 50K 100K 250K 500K 1000K 2000K
no match 0 1 2 4 12 26 56 136
all 0 0 0 1 3 7 14 28
first 0 1 2 4 12 26 56 136
1000th 0 1 2 4 13 28 62 145
middle 0 1 2 4 13 27 59 142
1000th from end 0 1 2 4 13 28 60 145
last 0 1 2 4 13 27 59 141
each 10'000th 0 1 2 6 22 69 290 1413
each 100'000th 0 1 2 4 13 30 81 261
Change-Id: I419a5521dd0be7676fbb09b34b4069d4a76423b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Removed 5.15 specific QVector code, which is unlikely usable now when
we are at 6.1+ timeline (that was really only a nice-to-have during
5.15 -> 6.0 transition)
Added "remove first" benchmark to track the fast (or not so fast)
removal path
Updated mid insertion and mid emplace to actually trigger both paths
(growing at the beginning and at the end), before it was really using
just one side, which is not quite the "mid" way it feels. Also changed
mid insertion to actually use the insert algorithm. Seems like
insert(i, t) calls emplace under the hood at least from the visual
introspection
Change-Id: I01b82cfa0ae38d481ea7362947f3607d757bf5d0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
pro2cmake did not take into account the
QT -= qt
bit of the .pro files.
Fixes: QTBUG-91676
Change-Id: If1373ee966312e4246490bd7389d75be9fa739cb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The use of "Country" is misleading as some entries in the enumeration
are not countries (eg, HongKong), for all that most are. The Unicode
Consortium's Common Locale Data Repository (CLDR, from which QLocale's
data is taken) calls these territories, so introduce territory-based
names and prepare to deprecate the country-based ones in due course.
[ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for
its Country enumeration, and associated territory-based names to match
its country-named methods, to better match the usage in relevant
standards. The country-based names shall in due course be deprecated
in favor of the territory-based names.
Fixes: QTBUG-91686
Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code has apparently been broken for quite a while, probably since
the change that made the QObject constructor invokable.
Fixes: QTBUG-91710
Pick-to: 6.0 6.1 5.15
Change-Id: I8b7e6c8a579913b3d0e2a364ffdbffe8d404c72b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
All backend-specific code is now separated and removed
from QSslSocket(Private) code. The original code is mostly
preserved to avoid (as much as possible) regressions (and
to simplify code-review).
Fixes: QTBUG-91173
Task-number: QTBUG-65922
Change-Id: I3ac4ba35d952162c8d6dc62d747cbd62dca0ef78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9391ba55149336c395b866b24dc9b844334d50da)
This makes the 5.15 and 6.x branches more comparable, as in 6.0 the
preferred way is to use the non-static methods (which avoids an
expensive lookup in 6.x).
As a drive-by, Avoid memory leaks if the test fails.
Pick-to: 6.0 6.1 5.15
Change-Id: I95b133342a4ea19dd23c235a408f38089706412b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Otherewise, we hit an assertion because the name is empty.
Fixes: QTBUG-91709
Pick-to: 6.0 6.1
Change-Id: I03a530d64ea8dead3efc5fcb8c00909388a387d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Otherwise the benchmark crashes as the data tag for the row would be
empty.
Fixes: QTBUG-91708
Pick-to: 6.0 6.1
Change-Id: I484ded5b8670571b80012e64d67846d3b8db5320
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
When a foreign event loop that does not enter an alertable wait state
is running (which is also the case when a native dialog window is
modal), pipe handlers would freeze temporarily due to their APC
callbacks not being invoked.
We address this problem by moving the I/O callbacks to the Windows
thread pool, and only posting completion events to the main loop
from there. That makes the actual I/O completely independent from
any main loop, while the signal delivery works also with foreign
loops (because Qt event delivery uses Windows messages, which foreign
loops typically handle correctly).
As a nice side effect, performance (and in particular scalability)
is improved.
Several other approaches have been tried:
1) Using QWinEventNotifier was about a quarter slower and scaled much
worse. Additionally, it also required a rather egregious hack to
handle the (pathological) case of a single thread talking to both
ends of a QLocalSocket synchronously.
2) Queuing APCs from the thread pool to the main thread and also
posting wake-up events to its event loop, and handling I/O on the
main thread; this performed roughly like this solution, but scaled
half as well, and the separate wake-up path was still deemed hacky.
3) Only posting wake-up events to the main thread from the thread pool,
and still handling I/O on the main thread; this still performed
comparably to 2), and the pathological case was not handled at all.
4) Using this approach for reads and that of 3) for writes was slightly
faster with big amounts of data, but scaled slightly worse, and the
diverging implementations were deemed not desirable.
Fixes: QTBUG-64443
Change-Id: I66443c3021d6ba98639a214c3e768be97d2cf14b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This patch marks some functions "override" to silence the corresponding
warning.
Change-Id: I88ccc5fa7521ecccc84a6cba9f06ea185cc5679e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The benchmark used to crash because QMetaType::typeName would return an
empty string, which is not a legal value for newRow.
Change-Id: I9e6c6c1cf153943bfa21181cd2cca596a7943ea0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Clang warning: 'isSequential' overrides a member function but is not
marked 'override' [-Winconsistent-missing-override]
Change-Id: I1a7c5516d2656469eab556e7f9d310192510b99b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
And remove the direct conversion so we can get both the SIMD
optimization and threading applied.
Change-Id: Id032ea91cc40c1cbf1c8a1da0386de35aa36cfb5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also remove tests/tests.pro that would be empty without the benchmarks.
Change-Id: Iaf92a729d1286b3e0c03bf9f877b59e1d83708e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- Skip unused metatype id
- Do not construct a QVariant from an int, when we instead want to
construct a QVariant for a given metatype (was: metatype id in Qt 5)
Pick-to: 6.0
Change-Id: I1ac19dec5549b424a9429f69999eaf8e96c022e2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The benchmark simply calls QRegularExpression's public API methods, so
that we can assess how changes to the implication impact performance.
(Its addition is prompted by evaluation of whether adding a move
constructor saves more or less than the resulting need for
d-pointer null-checks costs.)
Task-number: QTBUG-86634
Change-Id: Idef775ef6cf9f9ded3ce7ba5b85e460571d12756
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Those serve no purpose anymore, now that the .pro files are gone.
Task-number: QTBUG-88742
Change-Id: I39943327b8c9871785b58e9973e4e7602371793e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Per the discussion of QTBUG-88831, we determined that module-wide
imports are unfortunate, especially for compile times. Following this,
all QtDBus includes have been replaced with the headers for the classes
actually used in each file. Additionally, some cleanup of header file
order and format has been performed in the changed files.
Pick-to: 6.0
Change-Id: I62c1b75682a48422f0ba1168dd5d7bd0952808ac
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Complete search and replace of QtTest and QtTest/QtTest with QTest, as
QtTest includes the whole module. Replace all such instances with
correct header includes. See Jira task for more discussion.
Fixes: QTBUG-88831
Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44
Pick-to: 6.0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with
move semantics, its name is misleading. Q_RELOCATABLE_TYPE was
introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE
is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE
by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this
patch should have no impact on users.
Pick-to: 6.0
Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This patch removes two unused variables and marks one unused, fixing
three warnings.
Change-Id: I71f59839452590b82ffb5459a968f06bd434fb9a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This reverts commit ee122077b0.
Reason for revert: This causes QProcess::readAll() to sometimes
return nothing after the process has ended.
Fixes: QTBUG-88624
Change-Id: I34fa27ae7fb38cc7c3a1e8eb2fdae2a5775584c2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 23100ee61e33680d20f934dcbc96b57e8da29bf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
When a foreign event loop that does not enter an alertable wait state
is running (which is also the case when a native dialog window is
modal), pipe handlers would freeze temporarily due to their APC
callbacks not being invoked.
We address this problem by moving the I/O callbacks to the Windows
thread pool, and only posting completion events to the main loop
from there. That makes the actual I/O completely independent from
any main loop, while the signal delivery works also with foreign
loops (because Qt event delivery uses Windows messages, which foreign
loops typically handle correctly).
As a nice side effect, performance (and in particular scalability)
is improved.
Several other approaches have been tried:
1) Using QWinEventNotifier was about a quarter slower and scaled much
worse. Additionally, it also required a rather egregious hack to
handle the (pathological) case of a single thread talking to both
ends of a QLocalSocket synchronously.
2) Queuing APCs from the thread pool to the main thread and also
posting wake-up events to its event loop, and handling I/O on the
main thread; this performed roughly like this solution , but scaled
half as well, and the separate wake-up path was still deemed hacky.
3) Only posting wake-up events to the main thread from the thread pool,
and still handling I/O on the main thread; this still performed
comparably to 2), and the pathological case was not handled at all.
4) Using this approach for reads and that of 3) for writes was slightly
faster with big amounts of data, but scaled slightly worse, and the
diverging implementations were deemed not desirable.
Fixes: QTBUG-64443
Change-Id: I1cd87c07db39f3b46a2683ce236d7eb67b5be549
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
QChar should not be convertible from any integral type except from
char16_t, short and possibly char (since it's a direct superset).
David provided the perfect example:
if (str == 123) { ~~~ }
compiles, with 123 implicitly converted to QChar (str == "123"
was meant instead). But similarly one can construct other
scenarios where QString(123) gets accidentally used (instead of
QString::number(123)), like QString s; s += 123;.
Add a macro to revert to the implicit constructors, for backwards
compatibility.
The breaks are mostly in tests that "abuse" of integers (arithmetic,
etc.). Maybe it's time for user-defined literals for QChar/QString,
but that is left for another commit.
[ChangeLog][Potentially Source-Incompatible Changes][QChar] QChar
constructors from integral types are now by default explicit.
It is recommended to use explicit conversions, QLatin1Char,
QChar::fromUcs4 instead of implicit conversions. The old behavior
can be restored by defining the QT_IMPLICIT_QCHAR_CONSTRUCTION
macro.
Change-Id: I6175f6ab9bcf1956f6f97ab0c9d9d5aaf777296d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Instead of multiplexing all notifications into a single Qt event for
the event dispatcher, we can send 'WinEventAct' event directly for each
notifier which activated. This trick improves the performance (esp.
on a large number of events) and allows us to remove notifiers handling
from the event dispatcher completely.
As an alternative to sending Qt events, use of Windows' APC queue in
conjunction with waking up the Qt event loop from within the Windows
thread pool has been considered. However, that would lead to signal
emission asynchronous to the Qt event loop's operation, which is not
acceptable.
Thanks to Oswald Buddenhagen for the proposed idea.
[ChangeLog][QtCore][QAbstractEventDispatcher] The
{un}registerEventNotifier() member functions have been removed.
QWinEventNotifier is no longer needed to be registered in the
event dispatcher.
Change-Id: I140892fb909eaae0eabf2e07ebabcab78c43841c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>