The benchmark was making assumptions about number of
constructor/assignment operator calls, which are not valid in Qt 6,
after the implementation of QList has changed. Considering that we
already check number of constructions, copy constructions, etc., in
tst_qlist.cpp, remove the checks from the benchmark.
As a driveby, fix the following warning:
"warning: parameter 'i' shadows member inherited from type 'MyBase'"
Pick-to: 6.2
Fixes: QTBUG-95096
Change-Id: Ida68fa5803641c8fa84f8309c0093986ed4c0a2b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Open the file only if matching on content is needed.
Use QFileInfo::filePath() instead of QFileInfo::absoluteFilePath() in
QMimeDatabase::mimeTypeForFile(). filePath() does much less work, and so
is faster. Thiago Macieira helpfully explained in a review comment why
the absolute path is not useful for correctness here: "Nothing needs
absolute paths within the same application that would resolve the
relative path to absolute. You only need an absolute path if you're
communicating with another application that may be in a different
directory."
QMimeDatabase::mimeTypeForFile() checks fileInfo.isDir(), so the
fileName.endsWith(QLatin1Char('/')) check in
QMimeDatabasePrivate::mimeTypeForFileNameAndData() was redundant when
called from this function. The other two callers of that function now
check this condition before opening IO devices. This improves
performance of the two QMimeDatabase::mimeTypeForFileNameAndData()
overloads in the corner case.
Refactor and optimize QMimeDatabasePrivate::findByFileName() and its
usages. Previously each caller constructed a QFileInfo object and passed
QFileInfo::fileName() into this function. Now the callers simply pass an
absolute or relative path to a file into this function, which then uses
QFileSystemEntry::fileName() to exclude the path. Constructing QFileInfo
is relatively expensive, so this change slightly improves performance.
Optimize QMimeDatabasePrivate::loadProviders() by calling static
QFileInfo::exists() instead of constructing a QFileInfo object and
calling the non-static QFileInfo::exists() overload. Note that the
QFileInfo object was always created, even if QFileInfo::exists() under
an `if` and an `#if` was never called.
The following table contains the average results of the added benchmark
tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before
and at this commit. The numbers denote milliseconds per iteration.
data row tag before at
MatchDefault:
archive 0.029 0.016
OpenDocument Text 0.029 0.015
existent archive with extension 0.039 0.025
existent C with extension 0.033 0.020
existent text file with extension 0.033 0.020
existent C w/o extension 0.076 0.074
existent patch w/o extension 0.11 0.105
existent archive w/o extension 0.069 0.066
MatchExtension:
archive 0.012 0.0115
OpenDocument Text 0.0115 0.011
existent archive with extension 0.017 0.016
existent C with extension 0.011 0.011
existent text file with extension 0.011 0.011
existent C w/o extension 0.016 0.0155
existent patch w/o extension 0.013 0.012
existent archive w/o extension 0.013 0.012
MatchContent:
archive 0.019 0.012
OpenDocument Text 0.019 0.012
existent archive with extension 0.053 0.051
existent C with extension 0.056 0.0545
existent text file with extension 0.058 0.056
existent C w/o extension 0.0605 0.059
existent patch w/o extension 0.10 0.099
existent archive w/o extension 0.057 0.054
Change-Id: Idb541656e073a2c4822ace3f4da412f29f2351f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
The new argument allows atomic creation of files with non-default
permissions.
Task-number: QTBUG-79750
Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Results on my machine (only forever results):
********* Start testing of tst_QWaitCondition *********
Config: Using QtTest library 6.3.0, Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.2.1 20211115), ubuntu 20.04
PASS : tst_QWaitCondition::oscillate_QWaitCondition_QMutex(forever)
RESULT : tst_QWaitCondition::oscillate_QWaitCondition_QMutex():"forever":
637 msecs per iteration (total: 637, iterations: 1)
PASS : tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock(forever)
RESULT : tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock():"forever":
909 msecs per iteration (total: 909, iterations: 1)
PASS : tst_QWaitCondition::oscillate_std_condition_variable_std_mutex(forever)
RESULT : tst_QWaitCondition::oscillate_std_condition_variable_std_mutex():"forever":
331 msecs per iteration (total: 331, iterations: 1)
PASS : tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex(forever)
RESULT : tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex():"forever":
627 msecs per iteration (total: 627, iterations: 1)
PASS : tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock(forever)
RESULT : tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock():"forever":
913 msecs per iteration (total: 913, iterations: 1)
~331 vs. ~630ms. A pretty significant win (2x).
Mårten noticed that on Windows, condition_variable::wait_for(x, 0ms)
will not unlock the mutex, which, however, the program requires, so
use a 1ns timeout instead.
Drive-by fixes:
- add override to run() reimplementations
- fix type of timeout member variable (was int, should be unsigned long)
- fix naming of test functions to distinguish better between QMutex
and std::mutex
Change-Id: Ib92310f15fbd58258b2043504642be5f0b860f39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We have some special handling in qt_windows.h,
use it instead of the original windows.h
Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
In preparation for addition of new baseline tests, establish a new
test category, "baseline". This is similar to the category
"benchmarks" in that it contains tests that use the QTest framework,
but conceptually are not unit tests, in contrast to those under auto/.
Move the existing QPainter baseline test, tst_lancelot, into this new
category, and rename it accordingly.
Baseline tests use the QBaselineTest extension to QTest. Move that
extension too into the tests/baseline directory, allowing the clean
out of the baselineserver directory.
Pick-to: 6.2
Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time,
to unblock the developers from accessing the latest Windows APIs.
Pick-to: 6.2
Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt requires a compiler that support C++17 thus __cplusplus
is always 201703L or higher. This patch removes checks
for __cplusplus value that always succeed.
Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Make file names match CMake's test names (and those follow dir-name)
and class names follow tst_ClassName pattern when testing
ClassName. Purge comments about the qmake configs the CMakeLists.txt
are generated from. Purge empty constructors and init/cleanup methods
of classes. Fix petty coding style violations.
Add qdir/tree/, qurl, qbench and qset benchmarks to their parent directories'
lists of subdirs. Fix unused return error from qurl benchmark.
Change-Id: Ifc15a3a46e71cf82ad0637753517e0df34049763
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It tried to find its test-data-directory locally, instead of asking
FileSystem where it was keeping its files, relative to a temporary
directory. Its expected counts didn't match the arcane results of its
data file; since this is a benchmark, not a regression test, I'm
assuming that's just because it was never right or the rules for
QDirIterator's filtering have changed.
Tidied up somewhat in the process.
Change-Id: Ib2dcd314b11cb0f1a6fc425633afd0e9c39bd036
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QFont should be constructed with a list of font families.
Pick-to: 6.2
Change-Id: I61141b25d3f6e25f4fea141acbfa8e164d7af58f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The QtTest best practices documentations recommends using output
mechanisms such as qDebug() and qWarning() for diagnostic messages,
and this is also what most of our own tests do.
The QWARN() macro and corresponding internal QTest::qWarn() function
was added when QtTest was first implemented, but was likely meant as
an internal implementation detail, like its cousin QTestLog::info(),
which does not have any corresponding macro.
This theory is backed by our own QtTest self-test (tst_silent)
describing the output from QWARN() as "an internal testlib warning".
The only difference between QWARN() and qWarning(), besides the much
richer feature set of the latter, is that qWarning() will not pass
on file and line number information in release mode, but QWARN() will.
This is an acceptable loss of functionality, considering that the user
can override this behavior by defining QT_MESSAGELOGCONTEXT.
[ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning()
Pick-to: 6.2
Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The vsnprintf we use in QTest doesn't not have a portable %ls:
It accepts wchar_t, so it's UTF-32 on Linux and UTF-16 on Windows
Change-Id: I9ebda1e92b6e8e4dbbb79c6f2e35a833c587a089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
C++20 deprecated compound volatile statements such as pre- and
post-increments, to stress that they're not atomic. So instead of
volatile i;
~~~~;
++i;
you're now supposed to write
volatile i;
~~~~;
int j = i; // volatile load
++j;
i = j; // volatile store
which matches more closely what hardware does.
Instead of fixing every use of volatile pre- or post-increment in this
fashion individually, and realising that probably a few more Qt
modules will have the same kind of code patterns in them, write
QtPrivate functions to do the job centrally.
Change-Id: I838097bd484ef2118c071726963f103c080d2ba5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Before this change, next() was the only way to advance the iterator,
whether the caller was ultimately interested in just the filePath()
(good) or not (bad luck, had to call .fileInfo()).
Add a new function, nextFileInfo(), with returns fileInfo() instead.
Incidentally, the returned object has already been constructed as part
of advance()ing the iterator, so the new function is faster than
next() even if the result is ignored, because we're not calculating a
QString result the caller may not be interested in.
Use the new function around the code.
Fix a couple of cases of next(); fileInfo().filePath() (just use
next()'s return value) as a drive-by.
[ChangeLog][QtCore][QDirIterator] Added nextFileInfo(), which is like
next(), but returns fileInfo() instead of filePath().
Change-Id: I601220575961169b44139fc55b9eae6c3197afb4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
In two cases, it was as easy as replacing an unnamed enum's values
with constexpr variables. In the case of QSimplex, I opted for
qToUnderlying(), as the enum made sense on its own.
Change-Id: Ifcf5be14bd2f35e50adabdbd7ecdb2e83f6bf5b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
There's no point mentioning empty init(), constructor and destructor.
Change-Id: I0b820f62fd46a955aae891adfc68ca366ca60672
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Two QSqlRecord benchmarks that are only relevant for PostgreSQL were
being run for all backends, without producing useful results for the
others. Since the test is data-driven and the generic data-table code
can take a backend-name to decide which to include, pass a suitable
string to the generic data method instead, so that we now simply skip
these tests (and say we're doing so) rather than "passing" them.
Change-Id: I2223c16007a7095a9cadd13a9b2d46813507a35f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Because QBENCHMARK re-runs its block repeatedly, to get sensible data,
the block needs to actually do something when repeated. Since these
tests had blocks that looped while (qry.next()), they left qry at its
end state, so such repeats tested nothing. Use seek(0) at the start of
each cycle to actually do the work repeatedly when the block is
repeated. As a drive-by, split a long line.
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: Id46f77dc5e71335871af79ff61e1980b5f636179
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
At 1000, the set-up was taking longer than the five minutes
QtTestLib's WatchDog allows, so the test got killed.
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: Ia3c85b223fc917ad5817364505cbffe50d67ddc6
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Now that this event loop pays attention to test failures, we can avoid
the time-outs that used to happen on test failure. Also check for
premature failures (but don't return early, so we can shut down the
server gracefully) and give the event-loops sensible time-outs.
Task-number: QTBUG-91713
Change-Id: Ib895a5fba0f22654c7fecf996f23649a4b5ce0de
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Just in case the test isn't testing what we think it is.
One of my earlier changes didn't until this told me about it.
Change-Id: Idd6f415d543509cabb3a64219736bb43e60a70ef
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The sum of the first 100000 naturals is more than 2^32, so using an
int accumulator to collect the values is susceptible to overflow,
which is UB for signed integral types. So switch to an unsigned type.
We don't care about the actual sum, only having the various map
entries we fetch "used".
Since unsigned arithmetic is well-defined even when it overflows, we
can calculate the expected sum and verify it, to ensure that no matter
how clever the optimizer, it won't throw out the accumulator as
written but not read (and then optimize out all the tested code).
As a drive-by, rename one of the accumulators to match the rest.
Change-Id: I93a2825247c96ca88fe52fdb7ce1e5456eebad54
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Mostly so that I can put comments on them to indicate why some tests
are bigger and others not so big.
Change-Id: I633ceb264aa96ee8f5345e3f342a518e8ae4838b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
While we're here:
- remove the GCC precondition for compiling this benchmark.
Task-number: QTBUG-88484
Change-Id: I14f3ea7e4708e274d032a6297e9d4a87ae5dc1c0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Follow-up to commit 915be6606e, catching
some benchmarks that took for granted they can assign an arbitrary int
to QChar. Since 6.0 this has triggered an assertion.
Given the choice between limiting the range (from 100000 to 0x10000)
and actually handling the out-of-range values as UCS-4 data, the
latter seemed like a more interesting test.
At the same time, take the construction of the strings out of the
loop, as that's not a QMap performance matter, it's a QString one.
Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: Id6abab08b5c879f0f764350f66d6aa1dd9f1620a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Change a += to simple assignment where it's string arithmetic (a
hundred thousand concatenations of "Hello World" add up to more than a
megabyte, in an incremental growth that's going to dominate the QMap
operations we were meant to be benchmarking) and the only reason for
it is to avoid an unused result warning. Accumulating int values is
harmless, but strings are another story !
Pick-to: 6.1 6.2
Task-number: QTBUG-91713
Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
'main.cpp' is quite generic when using search to look for it.
Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The usual pattern (at least in corelib) is tst_bench_[lowercased
class-name] for the test and the same with .cpp for the source-file
name. So s/(main|tst_bench_vector)/tst_bench_qvector/g
Change-Id: Ic9bd3ac87adfaec189409c2259cc674ebcec602c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Purge comments showing assember from an antique g++ version,
skip #if-ery that's always been on, so makes no difference,
rename two single-letter variables shared between files,
move some extern declarations to a header,
wrap parts of a source file in QT_{BEGIN,END}_NAMESPACE,
add a TODO against an antique commented out #if-ery kludge.
Change-Id: Ic4781960e0c9838027c21d3d392a50f29598132c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The test constructs an ersatz object with which to overwrite a
QVector's internals, but based it on Qt 5's memory layout. Since Qt 6
completely rearranged that memory layout, the test now crashes (or, in
a debug build, trips over an out-of-bounds assertion).
So suppress the test until those who perpetrated it and/or the
reworking of QVector's internals can work out how to fix it.
That way, QA can at least run the benchmark without crashing.
Task-number: QTBUG-95061
Pick-to: 6.2
Change-Id: I0e8c8d58f2002497f6e29d0ad25f840e207704a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Let's have fewer files with the same main.cpp name.
Change-Id: Iad94478affcca73a25ed29ba4380f1b3ca4f329d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In the process, fix two coding-style violations: while loops whose
empty bodies were given as a semicolon rather than as empty braces.
Also ditch some spurious braces.
Change-Id: I2734077f4f54985c4e8d81f846c1fa6fac4f529d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
None of the tests modify the data, so there's no risk that one test
will cause another to fail via that. We can thus avoid the repeated
cost of that set-up and teardown, which was done repeatedly for each
test function since benchmarks get run repeatedly if they're quick.
Use QTemporaryDir to manage the test data, so that it's tidied away
automagically, instead of trying to tidy up at the end of each test
(which was, of course, skipped if the test failed).
As drive-bys, fix a typo in a QFAIL()'s message, change some C casts
that silently bulldozed const away to reinterpret_cast<>s with the
const qualifier and turn some heap buffers into stack buffers to save
the need to delete [] them at the end of their tests (also skipped on
failure).
Inspired by a kindred change by Andreas Buhr and a suggestion on its
review by Friedemann Kleint.
Pick-to: 6.2 6.1 5.15
Change-Id: I6067eb35babfbac02990ef39817b0d5122f563cd
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
They were there to make it easier to build the names.
Avoiding them wasn't exactly hard.
Change-Id: I9e353644d81f80d69ecf73fe4fa875948ccbc2c9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
The empty cleanupTestCase() was just clutter. Various tests that
shared a common implementation (using different data) might just as
well be inline in the class body.
Change-Id: I5046d7e6ad5a6425df9f9e0a0a705e229d9d0717
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The watch-dog timer was killing some tests, that take time quadratic
in the size of the data to test on, on their test-cases with larger
data-set sizes. Enable tuning of the data-table creation to leave off
the larger data-sets for thse tests.
Task-number: QTBUG-91713
Change-Id: I9f462f4f2ba03c6518486a26361aa2b847322f8c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The tests failed because they couldn't find the servers they needed to
run. The dbus server wasn't being built, due to mis-configured CMake
config; fixed dbus server CMake config. Once built, the servers werent
at the paths relative to the test binaries that were given in the test
source files, because the test binary was in the test/ sub-directory.
The dbus test just needed a ../ on its path; the qprocess one also
needed its path wrapped in QFINDTESTDATA(), and a ".exe" suffix on MS.
Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-91713
Change-Id: I5ace23a5815575bbf88ea88e0b16afc7b8ba6a08
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
For nonblocking Unix domain sockets the connection may not be
completed immediately. So, add a blocking call to waitForConnected()
to improve test stability. Also, explain a possible reason that
cause the connection to fail on Unix.
Task-number: QTBUG-91713
Change-Id: If34070f2383fd0c854e2707c734fe5da4bda1b42
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It may be the hobgoblin of little minds, but consistency makes code
easier to read. Turn the implementation test into a method of the
class, like all the others, and rename it to match the common pattern.
In the process, eliminate the data-column that was constant, use
simpler expressions for the lists whose entries are all the same and
Split some long lines.
The test still fails, as it did previously.
Change-Id: Ic2d6db1edc0bbafad91cd732babcbc129c430b8f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Including the error string gives whoever's running the test at least
some clue what's going wrong. One day it might even give them the
information they need to get later runs of the server past this
hurdle.
Task-number: QTBUG-95136
Change-Id: I5d67097339f1db78dfb7ba2ed4357121396977dd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Change-Id: I75941c295ba7d0a9bff5f12b49db28875b97c62a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Convert newRow() to addRow() to simplify formatting, use a ranged-for
iteration, take out a common factor of 1024, use QByteArray instead of
roundtripping ASCII via Unicode, and break some long lines.
Change-Id: I052730a71fb74f40a0dbd0695dcc286bc39896fb
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
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>