Commit Graph

698 Commits

Author SHA1 Message Date
Marc Mutz
8e0c2d7d22 Fix various -Wdeprecated-enum-float-conversions around the code
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>
2021-07-27 14:58:41 +02:00
Marc Mutz
18113e22e9 Add a benchmark for QSharedPointer
Initial results with GCC:

Even though GCC's assembly looks rather bad because of the implicit
fall-back from atomics to non-atomics for single-threaded
applications, libstdc++'s shared_ptr still performs twice as fast as
QSharedPointer, proving that the branch predictor eats libstdc++'s
is-multi-threaded-check for breakfast and the two atomic operations of
a QSharedPointer copy vs. one for std::shared_ptr dominate the
run-time.

********* Start testing of tst_QSharedPointer *********
Config: Using QtTest library 6.2.0, Qt 6.2.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.1.1 20210712), ubuntu 20.04
PASS   : tst_QSharedPointer::initTestCase()
PASS   : tst_QSharedPointer::refAndDeref_null_QSP_int()
RESULT : tst_QSharedPointer::refAndDeref_null_QSP_int():
     0.0000024 msecs per iteration (total: 81, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_SSP_int()
RESULT : tst_QSharedPointer::refAndDeref_null_SSP_int():
     0.0000024 msecs per iteration (total: 81, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_BSP_int()
RESULT : tst_QSharedPointer::refAndDeref_null_BSP_int():
     0.0000025 msecs per iteration (total: 87, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_QSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_null_QSP_QString():
     0.0000025 msecs per iteration (total: 86, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_SSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_null_SSP_QString():
     0.0000023 msecs per iteration (total: 80, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_null_BSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_null_BSP_QString():
     0.0000026 msecs per iteration (total: 88, iterations: 33554432)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_QSP_int()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_QSP_int():
     0.000019 msecs per iteration (total: 83, iterations: 4194304)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_SSP_int()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_SSP_int():
     0.000010 msecs per iteration (total: 90, iterations: 8388608)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_BSP_int()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_BSP_int():
     0.0000094 msecs per iteration (total: 79, iterations: 8388608)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_QSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_QSP_QString():
     0.000017 msecs per iteration (total: 75, iterations: 4194304)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_SSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_SSP_QString():
     0.000010 msecs per iteration (total: 90, iterations: 8388608)
PASS   : tst_QSharedPointer::refAndDeref_nonnull_BSP_QString()
RESULT : tst_QSharedPointer::refAndDeref_nonnull_BSP_QString():
     0.0000091 msecs per iteration (total: 77, iterations: 8388608)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_QSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_QSP_int():
     0.000016 msecs per iteration (total: 68, iterations: 4194304)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_SSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_SSP_int():
     0.000025 msecs per iteration (total: 53, iterations: 2097152)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_BSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_BSP_int():
     0.000027 msecs per iteration (total: 58, iterations: 2097152)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_QSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_QSP_QString():
     0.000016 msecs per iteration (total: 71, iterations: 4194304)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_SSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_SSP_QString():
     0.000027 msecs per iteration (total: 58, iterations: 2097152)
PASS   : tst_QSharedPointer::threadedRefAndDeref_null_BSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_null_BSP_QString():
     0.000017 msecs per iteration (total: 73, iterations: 4194304)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_int():
     0.00073 msecs per iteration (total: 96, iterations: 131072)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_int():
     0.000408 msecs per iteration (total: 107, iterations: 262144)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_int()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_int():
     0.00033 msecs per iteration (total: 89, iterations: 262144)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_QSP_QString():
     0.000877 msecs per iteration (total: 115, iterations: 131072)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_SSP_QString():
     0.00033 msecs per iteration (total: 89, iterations: 262144)
PASS   : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_QString()
RESULT : tst_QSharedPointer::threadedRefAndDeref_nonnull_BSP_QString():
     0.000385 msecs per iteration (total: 101, iterations: 262144)
PASS   : tst_QSharedPointer::cleanupTestCase()
Totals: 26 passed, 0 failed, 0 skipped, 0 blacklisted, 7995ms
********* Finished testing of tst_QSharedPointer *********

Change-Id: I0bed70142ffdbde6898ec0e27cb470b50fc0e97d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-27 14:58:41 +02:00
Edward Welbourne
1ae4c56ceb Purge empty methods from tst_QSqlRecord
There's no point mentioning empty init(), constructor and destructor.

Change-Id: I0b820f62fd46a955aae891adfc68ca366ca60672
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-23 20:35:02 +02:00
Edward Welbourne
415457302b Select PostgreSQL-only data, rather than filtering in the test
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>
2021-07-23 20:35:02 +02:00
Edward Welbourne
54e50792da Rename QSqlRecord benchmark's source file to match its test name
Change-Id: I580f185b3bbe283dfa2f43bbc986233d01219814
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-07-23 20:35:01 +02:00
Edward Welbourne
432eab3bc0 Make QSqlRecord benchmarks non-fatuous
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>
2021-07-23 20:35:01 +02:00
Edward Welbourne
346bdc6143 Halve the data-set size of tst_QSqlRecord::benchmarkRecord()
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>
2021-07-23 20:35:00 +02:00
Edward Welbourne
328f22561d Convert QLocalSocket benchmark to use QTestEventLoop
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>
2021-07-23 19:48:59 +02:00
Edward Welbourne
ebae6e2041 Assert some more things we can be sure of in the QMap benchmark
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>
2021-07-23 17:19:18 +02:00
Edward Welbourne
23434f487b QMap benchmark: use unsigned accumulators and check them
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>
2021-07-23 17:19:12 +02:00
Edward Welbourne
d0f9743d3b Rename QMap benchmark source file to match test name
s/main/tst_bench_qmap/g

Change-Id: Ic520254f5b5f946f4eaa234352317749a9a7301f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-07-23 17:19:04 +02:00
Edward Welbourne
b3e2e5f5b9 Give symbolic names to the sizes of data-sets tested in QMap benchmark
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>
2021-07-23 17:18:59 +02:00
Mårten Nordheim
640c5ca088 Add benchmarks for QString::number
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>
2021-07-22 23:01:41 +02:00
Edward Welbourne
b5950f6aff Use QChar::fromUcs4(i) rather than QChar(i) on out-of-range i
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>
2021-07-22 18:49:16 +02:00
Edward Welbourne
2e24ee02af Don't slow down a QMap benchmark by growing a megabyte-long string
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>
2021-07-21 20:33:24 +02:00
Mårten Nordheim
ec0b44003b QString benchmark: rename the source file
'main.cpp' is quite generic when using search to look for it.

Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-21 17:20:35 +02:00
Edward Welbourne
7a4bf7bd05 Rename QVector benchmark and its main.cpp for consistency
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>
2021-07-19 18:55:51 +02:00
Edward Welbourne
a87411cefa Clean up old QVector benchmark
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>
2021-07-19 16:55:51 +00:00
Edward Welbourne
406bb11a4e Suppress a broken benchmark comparing QVector to std::vector
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>
2021-07-19 18:55:51 +02:00
Edward Welbourne
d115f17cb8 Rename QFile benchmark's source file to tst_bench_qfile.cpp
Let's have fewer files with the same main.cpp name.

Change-Id: Iad94478affcca73a25ed29ba4380f1b3ca4f329d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 11:31:59 +02:00
Edward Welbourne
ec7b836455 Drop pointless parentheses from round case labels
Change-Id: I5339523f83aea4d91aaec9bd2570b225287ae23a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-19 11:31:55 +02:00
Edward Welbourne
31e094922c Replace Q_FOREACH() with ranged-for loops
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>
2021-07-19 11:31:46 +02:00
Edward Welbourne
e1b3a46302 QFile benchmark: only set up and tear down the data directory once
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>
2021-07-19 11:31:38 +02:00
Edward Welbourne
aff8d83512 Skip trailing space on ends of QFile benchmark names
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>
2021-07-16 17:01:24 +02:00
Edward Welbourne
cc7e0b5c2c QFile benchmark: purge fatuous function, inline several more
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>
2021-07-16 17:01:24 +02:00
Marc Mutz
d79b3cbdd3 QFile benchmark: fix -Wunused-result
Change-Id: Ibc8a146eb9eb6338f661f7813813ea0a0264c759
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-15 17:12:56 +02:00
Edward Welbourne
c61d18716f Limit some QList benchmark data-set sizes to avoid time-outs
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>
2021-07-15 17:06:54 +02:00
Edward Welbourne
bf99c2b62b Fix qdbusperformance and qprocess benchmarks
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>
2021-07-15 15:06:54 +00:00
Alex Trotsenko
ac40875ba7 QLocalSocket benchmark: improve connectivity and error reporting
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>
2021-07-15 18:06:54 +03:00
Edward Welbourne
19f522c74a QList benchmark: inline the removAll tests to match most others
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>
2021-07-15 17:06:53 +02:00
Edward Welbourne
65ac651f12 QLocalSocket benchmark: Report server error string if listen() fails
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>
2021-07-15 17:06:53 +02:00
Marc Mutz
9ee4290293 QStringList benchmark: fix the [[nodiscard]] warnings
Change-Id: I06572824e7037d8b14383b8867059aa2df493c82
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 16:57:31 +02:00
Marc Mutz
521e801b52 QString benchmark: fix the [[nodiscard]] warnings
Change-Id: I75941c295ba7d0a9bff5f12b49db28875b97c62a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 17:59:01 +02:00
Edward Welbourne
f1d40ca5e9 Unify and clean up two identical tst_qfile::*_data() functions
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>
2021-07-07 19:36:49 +02:00
Edward Welbourne
1cabfd1680 Move QSKIP()s to _data() functions in QFile benchmark
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>
2021-07-07 19:36:49 +02:00
Edward Welbourne
f74b2e3479 QFile benchmark: always use Unbuffered for QFSFileEngine tests
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>
2021-07-06 13:50:55 +02:00
Edward Welbourne
74e9b77f4f Fix QDirIterator benchmark to actually find its test data
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>
2021-07-06 13:50:55 +02:00
Marc Mutz
8c97f51425 QList benchmark: fix annoying -Wdeprecated-copy warning
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>
2021-06-30 23:13:27 +02:00
Sona Kurazyan
72e21ad3e9 Add basic benchmarks for QFuture
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>
2021-06-19 08:48:14 +02:00
Karsten Heimrich
ded82d1b07 Implement QFileInfo::junctionTarget(), adjust auto-test
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>
2021-06-05 01:16:06 +02:00
Karsten Heimrich
01f003f0aa Refactor createSymbolicLink() and createNtfsJunction()
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>
2021-06-02 23:02:45 +02:00
Mårten Nordheim
2ced64d240 QStringTokenizer: Add a benchmark
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>
2021-05-19 16:27:52 +02:00
Joerg Bornemann
92185d417d Fix BASE argument of qt_add_resources
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>
2021-05-18 16:02:52 +02:00
David Skoland
fea8ed0dcb Make loop variables references in date benchmark
This more accurately simulates real-world usage.

Change-Id: Ib1b49d165b3cfaef2bef51e958a1830cc7f8c285
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-27 15:34:50 +02:00
David Skoland
1ccf1ec99b Declare loop arg in benchmark unused
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>
2021-04-27 14:12:35 +02:00
Volker Hilsheimer
5f5fc9bf6f Fix QMetaType API deprecation warning in benchmark
Slipped through 1d3fe418e2.

Change-Id: I7ff39852a878ce76d48d5a1798a49f9137e00a13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-26 10:59:32 +02:00
Igor Kushnir
7c9597ef56 Add QSortFilterProxyModel clear-filter benchmark
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>
2021-04-25 13:25:01 +03:00
Andrei Golubev
3edba4b3d5 Update QList benchmark tests
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>
2021-04-21 15:01:13 +02:00
Qt CI Bot
455994c2ee Merge integration refs/builds/qtci/dev/1618512247 2021-04-16 07:57:01 +00:00
Joerg Bornemann
d437a0bfca Remove Qt dependency from some test helper executables
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>
2021-04-15 20:38:44 +02:00
JiDe Zhang
50a7eb8cf7 Add the "Territory" enumerated type for QLocale
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>
2021-04-15 20:17:49 +08:00
Volker Hilsheimer
1d3fe418e2 Replace deprecated APIs in metatype/variant benchmarks
Fix compiler warnings.

Change-Id: Id09b414f530a0d35c1a79e32112ff59185be2bc3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-14 14:38:42 +02:00
Andreas Buhr
dfe86d0150 Fix some warnings
Change-Id: I546300b4e630a2234c83c03ece65a08f4c8652d2
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-03-29 16:06:25 +02:00
Andreas Buhr
ce8f7e0ebd Fix some warnings
Change-Id: I9460606cefd8c4b5c01e576043c1bc8660b19de4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-25 09:24:03 +01:00
Fabian Kosmale
ed3df88846 tst_bench_qmetaobject: Fix test
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>
2021-03-19 14:37:51 +01:00
Timur Pocheptsov
b477d823ad Convert QSslSocket(Backend)Private into plugin
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)
2021-03-17 16:25:37 +01:00
Fabian Kosmale
a7f24218e3 tst_qguimetatype: Avoid deprecated methods
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>
2021-03-17 10:19:10 +01:00
Andreas Buhr
d0ba43f0f5 Fix warnings about marking functions override
Change-Id: I7737469d3016f9522e497b443edd864fa4d714cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-10 23:21:32 +01:00
Fabian Kosmale
3e46c22d94 tst_qguivariant benchmark: Only use valid QMetaTypes
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>
2021-03-10 18:00:39 +01:00
Fabian Kosmale
90dc1f9204 tst_bench_qguimetatype: only consider valid metatypes
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>
2021-03-10 17:59:49 +01:00
Alex Trotsenko
f265c87e01 Allow QWindowsPipe{Reader|Writer} to work with foreign event loops, take 2
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>
2021-03-02 22:53:06 +02:00
Andreas Buhr
a944de7742 Fix some warnings about virtual/override
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>
2021-02-23 15:15:45 +01:00
Volker Hilsheimer
784276cc72 Fix compiler warning: initialize variable
The initialization happens outside the bechmarking loop.

Change-Id: Id661fa2f995e964277a5c388b8fac13ff8687d92
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-02-11 21:05:53 +01:00
Fabian Kosmale
1316af2f3e Fix QMetaType benchmark
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>
2021-02-04 13:29:46 +01:00
Volker Hilsheimer
f2e5621451 Fix compiler warning in QNetworkReply test
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>
2021-02-03 23:46:25 +01:00
Allan Sandfeld Jensen
936d499ed4 Optimize RGBA64->RGBA64PM for SSE2/AVX2
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>
2021-02-03 08:22:16 +01:00
Allan Sandfeld Jensen
bde773ec6a Fix a few compiler warnings in tests
Change-Id: I22f6ac8ed02dd4ef4083ce3c781552623a0b08da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-02-02 12:06:05 +01:00
Joerg Bornemann
7d1cda9de3 Remove qmake project files for benchmarks
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>
2021-02-01 21:14:01 +01:00
Maximilian Goldstein
bd520ccc3c Import qproperty benchmarks from private repo
Change-Id: Icff5685b921f8a99acfeda1d79bb03ee652aa107
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-29 11:55:42 +01:00
Fabian Kosmale
6d3a886f09 QVariant benchmark: fix crashes
- 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>
2021-01-27 15:00:56 +01:00
Ivan Solovev
fb51b4732c Add simple benchmark for QRegularExpression
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>
2021-01-20 16:31:07 +01:00
Volker Hilsheimer
45dc973d96 Remove unused variable from QNetworkReply benchmark
Fixes compiler warning.

Change-Id: I73963f9f711b02d999b366dbf884acd5c851c950
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-01-19 20:04:12 +01:00
Joerg Bornemann
04f11f9935 Remove .prev_CMakeLists.txt files
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>
2021-01-12 20:59:13 +01:00
David Skoland
9e09677c1d Remove QtDBus includes
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>
2021-01-12 09:19:27 +01:00
David Skoland
27d96b4789 Replace QtTest headers with QTest
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>
2020-12-22 15:20:30 +01:00
Alexandru Croitor
2304acab5f CMake: Regenerate projects using pro2cmake one last time
And fix up some wrong qmake project files

Pick-to: 6.0
Change-Id: I66cb82aeb9c1419a74df1a650fa78a511ade7443
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-12-10 11:52:30 +01:00
Andreas Buhr
0440614af0 Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE
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>
2020-11-30 17:16:21 +01:00
Andreas Buhr
5e84023344 Fix warnings about unused variables in benchmarks
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>
2020-11-30 17:16:21 +01:00
Allan Sandfeld Jensen
f61f8bb966 Replace qt_make_unique with std::make_unique
We can depend on C++14 now.

Change-Id: Iee9796cd22dbfbb70d4bdb25f0eee1662a026d6d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-11-23 09:50:21 +01:00
Kai Koehne
ce29ce586f Revert "Allow QWindowsPipe{Reader,Writer} to work with foreign event loops"
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>
2020-11-20 13:28:31 +00:00
Alex Trotsenko
1e9dc3ec2f CMake: fix QLocalSocket benchmark to use new qt_internal_ API
Amends ee122077b.

Change-Id: I9b750eb88ac9c83da26da4e5921cb147716c5eb6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-11-17 21:34:04 +02:00
Alex Trotsenko
ee122077b0 Allow QWindowsPipe{Reader,Writer} to work with foreign event loops
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>
2020-11-17 12:45:50 +02:00
Giuseppe D'Angelo
1869615fc9 QChar: make construction from integral explicit
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>
2020-11-15 14:41:05 +01:00
Alex Trotsenko
aefd414ce2 QWinEventNotifier: unlink from event dispatcher
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>
2020-11-10 17:56:51 +02:00
Andrei Golubev
250b69ace4 Fix QArrayDataOps generic and relocatable emplace()
Emplace() implemented with std::rotate is just awful on my system
(Ubuntu 18.04 GCC 7.5.0). Custom code is much faster, so go for
it. Cannot really use insert() code, which is also fast, because
it doesn't forward-reference values but copies them always

Changes in performance (approximately) for emplacing 100k elements
into the middle:
Complex 7600ms -> 1700ms
Movable 7600ms -> 200ms

Task-number: QTBUG-86583
Change-Id: If883c9b8498a89e757f3806aea11f8fd3aa3c709
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-09 17:36:31 +01:00
Andrei Golubev
02a5928fa5 Add QList/QVector benchmark tests
Added some simple benchmarks for QList insertion of 1 element

Added same tests for QVector (within the same file) for 5.15

Task-number: QTBUG-87330
Task-number: QTBUG-86583
Pick-to: 5.15
Change-Id: I19a851c79cf5ce0329266883e99ecaf2d6b3df19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-04 11:21:01 +01:00
Edward Welbourne
c8d42961a0 Add constructor benchmarks for QLocale, to test likely sub-tag matching
Change-Id: Ib4c1d0ea031a581020c1f050fa4096d5196cc752
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-26 15:56:06 +02:00
Andreas Buhr
2516fc935c Add benchmark for QString::number(int)
Add a almost trivial benchmark for QString::number(int).

Change-Id: Ice67eaf28e8d7b235fd5ec5e0b87b3b9053ae61e
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-10-23 06:55:35 +02:00
Edward Welbourne
5a948dd50b Fix [[nodiscard]] compile errors in QLocale benchmark
QString::toUpper() now insists we use its return, so the benchmark
won't compile unless we do so. Also document the helper macro used by
the tests, to explain why it's even there at all.

Change-Id: I830f121d92867bcd09277ecdeb1c764413b34fa6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-19 17:45:30 +02:00
Lars Knoll
77d812683f Refactor QMutexLocker to be able to handle recursive mutexes
Since we're going to split QMutex and QRecursiveMutex into
separate classes, make sure QMutexLocker is prepared for that.

Change-Id: Id5e9a955d1db7c8ee663dd3811ad6448dad0aeae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-17 12:02:49 +02:00
Volker Hilsheimer
1c76aa077e Get rid of all usage of QApplication:desktop
Use QScreen APIs instead.

Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-10-14 06:38:43 +02:00
Allan Sandfeld Jensen
564b59d903 Another round of replacing 0 with nullptr
This time based on grepping to also include documentation, tests and
examples previously missed by the automatic tool.

Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-07 23:02:47 +02:00
Alexandru Croitor
403213240c CMake: Regenerate projects to use new qt_internal_ API
Modify special case locations to use the new API as well.
Clean up some stale .prev files that are not needed anymore.
Clean up some project files that are not used anymore.

Task-number: QTBUG-86815
Change-Id: I9947da921f98686023c6bb053dfcc101851276b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-09-23 16:59:06 +02:00
Alexandru Croitor
a3bd80c08c CMake: Regenerate projects
Clean up the state of the projects,
before changing the internal CMake API function names.

Task-number: QTBUG-86815
Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-09-22 19:08:53 +02:00
Allan Sandfeld Jensen
5f198584e2 Define inverted QRects consistently
Changes the definition of invalid QRects to be more consistent.
This simplifies the logic, and makes it possible for us to fix
normalized() so dimensions don't change.

The actual API is not changed except for inverted rects.

Only one use-case for the old normalized() function existed,
and has been reimplemented as QRect::span().

Fixes: QTBUG-22934
Change-Id: I29dad2952dc6c8e84a6d931898dc7e43d66780f3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-21 15:04:51 +02:00
Christian Ehrlicher
4e2656a6d2 QStyleOptionGraphicsItem: remove deprecated member matrix/levelOfDetail
QStyleOptionGraphicsItem::matrix and levelOfDetail are deprecated and
not used anywhere anymore.

Change-Id: Id4b0fa8ac3ac53d771e858ecda5524a5e690342d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-06 18:31:43 +02:00
Edward Welbourne
26547c296b Purge qalgorithm.h of deprecated API
A large slice of it has been deprecated since 5.2.

Reflowed a doc paragraph pointed out, in the deprecation commit, as
having been left ragged by its edits.

Note: qSwap() is documented as \deprecated but not marked, where it's
defined, as deprecated.

Change-Id: Iaff10ac0c4c38e5b85f10eca4eedeab861f09959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-28 21:22:32 +02:00
Lars Knoll
acbf9a858b Cleanup QTypeInfo
Remove QTypeInfo::isStatic, as that's not used anymore in Qt 6.
Also remove sizeOf, it's unused, and we have QMetaType for that if
required.
Remove all typeinfo declaractions for trivial types, as the default
template covers them correctly nowadays.

Finally set up a better default for isPointer, and do some smaller
cleanups all over the place.

Change-Id: I6758ed37dfc701feaaf0ff105cc95e32da9f9c33
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-26 01:03:22 +02:00
Lars Knoll
524edc7363 Clean up QVariant::Private::Data
Remove all the internal members of the union. Instead replace
it with raw storage (uchar[]) aligned to max_align_t.

Place all accesses to the internal members with get<> methods
for consistency.

Change-Id: Icebf46b90c9375aa6ea0b5913b2132608e8c223d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:17:05 +02:00
Karsten Heimrich
2766322de3 Move QStringRef and remains to Qt5Compat
Export some private functions from QUtf8 to resolve
undefined symbols in Qt5Compat after moving QStringRef.

Task-number: QTBUG-84437
Change-Id: I9046dcb14ed520d8868a511d79da6e721e26f72b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-20 00:58:13 +02:00
Lars Knoll
8929c0a355 Remove QVariant(int type, void *data, ...) constructor
It was marked internal anyway. Use the constructor taking a
QMetaType instead.

Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-15 10:56:29 +02:00
Allan Sandfeld Jensen
6f0df02d00 Replace Qt CONSTEXPR defines with constexpr
Both normal and relaxed constexpr are required by our new minimum of
C++17.

Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-14 15:52:58 +02:00
Mårten Nordheim
d40f88e8d2 QDecompressHelper: Introduce zstd support
Also take this opportunity to reshuffle the content-encodings in the
intended ordering since the ordering is used to signify priority.

Task-number: QTBUG-83269
Change-Id: I022eecf1ba03b54dbd9c98a9d63d05fb05fd2124
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-14 13:17:11 +02:00
Mårten Nordheim
ad1a5bf63f QDecompressHelper: Add brotli support
Task-number: QTBUG-83269
Change-Id: If23b098ee76a4892e4c2c6ce5c635688d8d9138d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-06 20:56:42 +02:00
Alexandru Croitor
92ee9bd6b8 CMake: Properly handle CONFIG += thread aka Threads::Threads
mkspecs/features/qt.prf adds a dependency on the system threading
library if the Qt Core thread feature is enabled. Because qt.prf is
loaded by any public or internal Qt project, it's essentially a public
dependency for any Qt consumer.

To mimic that in CMake, we check if the thread feature is enabled, and
and set the Threads::Threads library as a dependency of Qt6::Platform,
which is a public target used by all Qt modules and plugins and Qt
consumers.

We also need to create a Qt6Dependencies.cmake file so we
find_package(Threads) every time find_package(Qt6) is called.

For the .prl files to be usable, we have to filter out some
CMake implementation specific directory separator tokens
'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call
target_link_libraries() with a target created in a different scope
(I think).

As a result of this change, we shouldn't have to hardcode
Threads::Threads in other projects, because it's now a global public
dependency.

Task-number: QTBUG-85801
Task-number: QTBUG-85877
Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-08-06 19:15:39 +02:00
Mårten Nordheim
07b008425a Privately introducing QDecompressHelper for network purposes
To support streaming decompression in QNAM.
Will also be used to refactor existing decompression code in QNAM.

Task-number: QTBUG-83269
Change-Id: Iecf3e359734163f15686c949f75d41fa4794a00e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-05 09:17:11 +02:00
Edward Welbourne
a6b3a1e459 Remove deprecated binary json feature
Deprecated in 5.15 in favor of CBOR.

Fixes: QTBUG-81239
Change-Id: I711d4bd7dd1247f58e77ac9fa53304cbe5028918
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 17:12:48 +02:00
Peng Wenhao
59e3073b1c Close memory leak in QTestLib support for string to numeric testing
QTest::toString allocates memory by calling qstrdup; that memory must
be freed by the caller.

Change-Id: I9724db0c617884cf08592968b1411f002ef23204
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 13:36:31 +08:00
Sona Kurazyan
361dc074f2 Move QRegExp and its remaining mentions out of QtCore
Task-number: QTBUG-85235
Change-Id: Ibd6c98d952c1bb9916b64715c6430fb0d3fe3843
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-13 10:53:23 +02:00
Alexandru Croitor
1718948ed4 CMake: Regenerate benchmarks
Change-Id: I4154d9ebb8303338a07350b655c7b468751efd10
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-08 11:01:38 +02:00
Lars Schmertmann
6ce2f3f26b Add ; to Q_UNUSED
This is required to remove the ; from the macro with Qt 6.

Task-number: QTBUG-82978
Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:51:48 +02:00
Jarek Kobus
d33655a953 Use QList instead of QVector in other qtbase tests
Task-number: QTBUG-84469
Change-Id: Ie0455c890c048c52eacad1badd6d21df999badf9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:48:45 +02:00
Lars Schmertmann
18cfabafa6 Remove unnecessary ; after function implementations
Task-number: QTBUG-82978
Change-Id: Iea3bcaec1ef9f4bd0f73e5dccca33354650f5bf4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-06 11:46:39 +02:00
Jarek Kobus
74dc89de3e Use QList instead of QVector in benchmarks tests
Task-number: QTBUG-84469
Change-Id: Id61d6036067da0bcd0811b1b97df5f1334007b7e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-25 10:13:31 +02:00
Sona Kurazyan
d7ccd8cb45 Remove QByteArray's methods taking QString and their uses
[ChangeLog][QtCore][QByteArray] Remove method overloads taking
QString as argument, all of which were equivalent to passing the
toUtf8() of the string instead.

Change-Id: I9251733a9b3711153b2faddbbc907672a7cba190
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-25 09:54:16 +02:00
Volker Hilsheimer
75638e258f Don't pollute global namespace with #define P
Breaks the build if any global header has

using P = SomeType;

statement, and unnecessary to do so before the headers are included.

Change-Id: I3b8cc705bf662f768b8895e4b3ec1428ab39ef27
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-25 06:19:50 +02:00
Timur Pocheptsov
c2bf56fc3a QSslSocket: remove certificate-related setters
They were deprecated with replacements in QSslConfiguration proposed (and
some without alternative, which we'll provide if there is any demand
in such an API). Special thanks to M.N. for a nice hint on how to
amend the test without introducing a new API.

Change-Id: I7841a5b3f30469d8204b61cb65921c34275e0650
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-22 12:11:47 +02:00
Karsten Heimrich
18ec53156e Move QTextCodec support out of QtCore
* Assume UTF-8 on all Unix like systems
* Export some functions to be able to compile QTextCodec once
  moved to Qt5Compat.

Task-number: QTBUG-75665
Change-Id: I52ec47a848bc0ba72e9c7689668b1bcc5d736c29
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-20 02:04:38 +02:00
Giuseppe D'Angelo
3e1d03b1ea Port Q_STATIC_ASSERT(_X) to static_assert
There is no reason for keep using our macro now that we have C++17.
The macro itself is left in for the moment being, as well as its
detection logic, because it's needed for C code (not everything
supports C11 yet).  A few more cleanups will arrive in the next few
patches.

Note that this is a mere search/replace; some places were using
double braces to work around the presence of commas in a macro, no
attempt has been done to fix those.

tst_qglobal had just some minor changes to keep testing the macro.

Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-19 19:38:23 +02:00
Volker Hilsheimer
44fb925f50 Phase 2 of removing QDesktopWidget
Remove QDestopWidget public header, simplify the implementation that
maintains a Qt::Desktop type QWidget for each QScreen, and turn
QWidget's initial target screen into a QScreen pointer.

QApplication::desktop() now takes an optional QScreen pointer, and
returns a QWidget pointer, so that applications and widgets can get
access to the root widget for a specific screen without having to
resort to private APIs.

QDesktopWidgetPrivate implementations to look up a screen for an index,
widget, or point are now all inline functions that thinly wrap
QGuiApplication::screens/screenAt calls. We should consider adding those
as convenience APIs to QScreen instead.

Note that QWidget::screen is assumed to return a valid pointer; there is
code that handles the case that it returns nullptr (but also code that
trusts that it never is nullptr), so this needs to be defined, verified
with tests, and asserted. We can then simplify the code further.

Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-06-08 20:29:49 +02:00
Oliver Wolff
45b0f1be68 Remove winrt
Macros and the await helper function from qfunctions_winrt(_p).h are
needed in other Qt modules which use UWP APIs on desktop windows.

Task-number: QTBUG-84434
Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-06 20:25:49 +02:00
Lars Knoll
b2ee684a13 Remove QRegExp support from QString and StringList
Replacement methods do now exist in QRegExp, or
for QRegularExpression when porting to it.

Remove all autotests associated with the old methods.

Change-Id: I3ff1e0da4b53adb64d5a48a30aecd8b960f5e633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 14:19:47 +02:00
Qt Forward Merge Bot
efd7757154 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/widgets/widgets/qabstractbutton.cpp
	src/widgets/widgets/qbuttongroup.cpp
	src/widgets/widgets/qbuttongroup.h
	src/widgets/widgets/qsplashscreen.cpp
	tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp
        tests/benchmarks/opengl/main.cpp

  Needed update:
	src/plugins/platforms/cocoa/CMakeLists.txt

Change-Id: I7be4baebb63844ec2b3e0de859ca9de1bc730bb5
2020-04-22 15:28:01 +02:00
Edward Welbourne
7202df3689 Replace QTime with QElapsedTimer in benchmarks
Various benchmarks were still using the deprecated timing API.
One didn't even *use* the timer it implemented this way.
One was just using start as a short-hand for assigning to currentTime().

Change-Id: If406d0fb606e454fec056f386bcd0aa6726ee96e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-04-20 17:44:13 +02:00
Volker Hilsheimer
09dd94091f Remove deprecated members from graphics view classes
Change-Id: Ia192de674b1085edcf4a88cdeada6df89b442ddd
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-16 16:53:33 +02:00
Qt Forward Merge Bot
c937ed8af4 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-04-08 22:04:23 +02:00
Alexandru Croitor
e0346df1b2 CMake: Handle finding of OpenSSL headers correctly
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.

Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.

Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.

FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.

The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.

Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.

Adjust the projects and tests to use the new target names.

Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).

Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-04-08 22:03:24 +02:00
Qt Forward Merge Bot
8823bb8d30 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	examples/opengl/doc/src/cube.qdoc
	src/corelib/global/qlibraryinfo.cpp
	src/corelib/text/qbytearray_p.h
	src/corelib/text/qlocale_data_p.h
	src/corelib/time/qhijricalendar_data_p.h
	src/corelib/time/qjalalicalendar_data_p.h
	src/corelib/time/qromancalendar_data_p.h
	src/network/ssl/qsslcertificate.h
	src/widgets/doc/src/graphicsview.qdoc
	src/widgets/widgets/qcombobox.cpp
	src/widgets/widgets/qcombobox.h
	tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
	tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
	tests/manual/diaglib/debugproxystyle.cpp
	tests/manual/diaglib/qwidgetdump.cpp
	tests/manual/diaglib/qwindowdump.cpp
	tests/manual/diaglib/textdump.cpp
	util/locale_database/cldr2qlocalexml.py
	util/locale_database/qlocalexml.py
	util/locale_database/qlocalexml2cpp.py

Resolution of util/locale_database/ are based on:
https://codereview.qt-project.org/c/qt/qtbase/+/294250
and src/corelib/{text,time}/*_data_p.h were then regenerated by
running those scripts.

Updated CMakeLists.txt in each of
	tests/auto/corelib/serialization/qcborstreamreader/
	tests/auto/corelib/serialization/qcborvalue/
	tests/auto/gui/kernel/
and generated new ones in each of
	tests/auto/gui/kernel/qaddpostroutine/
	tests/auto/gui/kernel/qhighdpiscaling/
	tests/libfuzzer/corelib/text/qregularexpression/optimize/
	tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/
	tests/libfuzzer/gui/text/qtextdocument/sethtml/
	tests/libfuzzer/gui/text/qtextdocument/setmarkdown/
	tests/libfuzzer/gui/text/qtextlayout/beginlayout/
by running util/cmake/pro2cmake.py on their changed .pro files.

Changed target name in
	tests/auto/gui/kernel/qaction/qaction.pro
	tests/auto/gui/kernel/qaction/qactiongroup.pro
	tests/auto/gui/kernel/qshortcut/qshortcut.pro
to ensure unique target names for CMake

Changed tst_QComboBox::currentIndex to not test the
currentIndexChanged(QString), as that one does not exist in Qt 6
anymore.

Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
2020-04-08 20:11:39 +02:00
Qt Forward Merge Bot
86d9e36b06 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	tests/benchmarks/corelib/text/qstringlist/qstringlist.pro

Change-Id: Ie9b97bd83c2df00fd9b556b5f09d405f71970169
2020-04-03 09:01:44 +02:00
Edward Welbourne
53ed635dbb Set CONFIG += benchmark in corelib's various benchmarks
This leads to "make benchmark" actually running the benchmark, which
would be nice, I think. Purged various CONFIG += release or -= debug
lines from the same configurations; those surely only configure how
the test code is compiled, which is more or less pointless; it's the
code under test whose debug/release state matters, and I don't suppose
that's affected by the build config of the test code.

In the process, reduce diversity of the ordering of lines within these
*.pro files and purge some dangling space.

Change-Id: Ia9f9f0ca4c096262de928806bdfa6ea3b9e7b9ba
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-02 18:33:42 +02:00
Liang Qi
576dc2c701 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/plugins/platforms/xcb/qxcbdrag.cpp

Change-Id: I0b47324b70b0b4894e54b21aa3e7a5041f9bd5e3
2020-03-24 14:36:02 +01:00
Robin Burchell
2af04860f6 qtimezoneprivate_tz: Apply a cache over the top of timezone data
Constantly re-reading the timezone information only to be told the exact
same thing is wildly expensive, which can hurt in operations that cause
a lot of QTimeZone creation, for example, V4's DateObject - which
creates them a lot (in DaylightSavingTA).

This performance problem was identified when I noticed that a
QDateTime binding updated once per frame was causing >100% CPU usage
(on a desktop!) thanks to a QtQuickControls 1 Calendar (which has a
number of bindings to the date's properties like getMonth() and so
on).

The newly added tst_QTimeZone::systemTimeZone benchmark gets a ~90%
decrease in instruction count:

--- before
+++ after
 PASS   : tst_QTimeZone::systemTimeZone()
 RESULT : tst_QTimeZone::systemTimeZone():
-     0.024 msecs per iteration (total: 51, iterations: 2048)
+     0.0036 msecs per iteration (total: 59, iterations: 16384)

Also impacted (over in QDateTime) is
tst_QDateTime::setMSecsSinceEpochTz(). The results here are - on the
surface - less impressive (~0.17% drop), however, it isn't even
creating QTimeZone on a hot path to begin with, so a large drop would
have been a surprise.

Added several further benchmarks to cover non-system zones and
traverse transitions.

Done-With: Edward Welbourne <edward.welbourne@qt.io>
Task-number: QTBUG-75585
Change-Id: I044a84fc2d3a2dc965f63cd3a3299fc509750bf7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-20 16:58:09 +02:00
Lars Knoll
47b1e883e4 Remove the old harfbuzz library and integration code
It's not used anymore. harfbuzz-ng is a requirement in Qt 6 if you
want any open type shaping.

Fixes: QTBUG-82881
Change-Id: If7100aebdcfa078a999608bb8f07a2ef3a79d282
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2020-03-17 01:43:29 +01:00
Alexandru Croitor
8facb31fde CMake: Regenerate tests projects
Change-Id: I559bf2c82d83fac9bd3c52a331d99e1e83bc3f87
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:39 +01:00
Qt Forward Merge Bot
865afac250 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
2020-03-11 15:34:21 +01:00
Jarek Kobus
50d2acdc93 Add default arguments to QPainterPath methods using transform
Fixes: QTBUG-82602
Change-Id: Id82f145ffb33e6d4ef9b81282ad14657b1c8fbd0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-06 21:09:48 +01:00
Qt Forward Merge Bot
63312fe2ec Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: If36d96c0fef3de5ab6503977501c55c62a2ecc97
2020-03-03 14:13:02 +01:00
Edward Welbourne
305ddbeb5b Use Qt::SplitBehavior in preference to QString::SplitBehavior
The Qt version was added in 5.14 "for use as eventual replacement for
QString::SplitBehavior." Move another step closer to that goal.

Change-Id: I399b5ea56e9255e775ca1746632f7421519a6616
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-02-28 15:37:11 +01:00
Johan Klokkhammer Helsing
3673ee9823 Fix build errors for GraphicsViewBenchmark
QGL* has been removed amongst other things

Task-number: QTBUG-74408
Task-number: QTBUG-74409
Change-Id: Ia19774f2bb6d0b86b3fbde224cbc8652b4ae0b22
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-02-28 12:03:48 +01:00
Lars Knoll
a450cce6b6 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
2020-02-28 09:48:30 +01:00
Alexander Akulich
4c86e667d2 Revert "QNetworkReply: deprecate the 'error' getter"
This reverts commit ccb2cb84f5 and
commit 0f568d0a67.

The patches fix ambiguity between a getter and a signal by changing the
getter name, but we still have to rename the signal to follow the signals
naming convention.

Revert the commits to keep the getter as is and change the signal name instead.

Change-Id: Iddbab7c33eea03826ae7c114a01857ed45bde6db
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-02-28 07:21:14 +03:00
Johan Klokkhammer Helsing
f6f6eab89f Remove opengl benchmark
It used QGLPixelBuffer. Not sure how/if it could've been ported to QOpenGL.

Task-number: QTBUG-74408
Change-Id: I1271f501ccad4ae391ee0f6fc5a1ddfaf46ef0af
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-02-27 14:31:49 +01:00
Leander Beernaert
0959c75d16 Apply the same fix from test/auto/network to network benchmarks
Change-Id: I81d41aa526d5c06adef637e756a3d81e799443e4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-20 16:11:01 +01:00
Alexandru Croitor
0d177053b9 Regenerate projects one last time before merge
Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-12 17:30:49 +00:00
Alexandru Croitor
c9e67a7926 CMake: Regenenerate projects where recent changes happened
Change-Id: If86e49d73a45b7cfc494fa48bdc6cb1ba503b112
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-11 10:19:45 +01:00
Mårten Nordheim
3568ad58f5 Introduce a configure-time check for C++17 filesystem
Various compilers have various fun ways of failing to compile when it
is used so let's check if they will work properly during configure
rather than much later.

Change-Id: Ia93d4b91b3d269b4cab2a5f677c3c89e06b44ce3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-07 23:51:06 +01:00
Alexandru Croitor
43d2b60a29 Post-merge fixes
Change-Id: I6acd29103f6cc550544e7422328d97ea0e2dcafb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-30 20:45:08 +00:00
Alexandru Croitor
a1dbdcbd6e Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
        src/corelib/Qt5CoreConfigExtras.cmake.in
        src/corelib/Qt5CoreMacros.cmake
        src/dbus/Qt5DBusConfigExtras.cmake.in
        src/widgets/Qt5WidgetsConfigExtras.cmake.in

Change-Id: Ib782f3b177c38b2cce83beebe15be9c0baa578f7
2020-01-29 16:57:27 +01:00
Simon Hausmann
a4ea0d9eac Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia5727ce68001bcaab467f5fae3a4933d1217015f
2020-01-28 18:27:28 +01:00
Qt Forward Merge Bot
558fc903ac Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/io/qsettings.cpp
	src/corelib/kernel/qvariant.cpp
	src/corelib/serialization/qjsoncbor.cpp
	src/corelib/serialization/qjsonvalue.cpp
	src/corelib/tools/tools.pri
	src/gui/image/qimage.cpp
	src/gui/kernel/qguivariant.cpp
	src/widgets/kernel/qshortcut.cpp
	tests/auto/tools/moc/allmocs_baseline_in.json
	tests/auto/tools/moc/tst_moc.cpp
        src/opengl/qglframebufferobject.cpp

Done-With: Edward Welbourne <edward.welbourne@qt.io>
Done-With: Leander Beernaert <leander.beernaert@qt.io>
Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
2020-01-28 14:14:20 +00:00