Commit Graph

231 Commits

Author SHA1 Message Date
Mårten Nordheim
d98a1ef902 Add QMap::insert(const QMap &map)
As opposed to unite(), this inserts one map into the other
without duplicating elements.

Task-number: QTBUG-35544
Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-12 15:25:30 +01:00
Tor Arne Vestbø
c3bd5ffdc8 Don't wrap feature detection macros with QT_HAS_FOO() variants
Using wrappers for these macros is problematic when for example passing the
-frewrite-includes flag to preprocess sources before shipping off to distcc
or Icecream. It will also start producing warnings when compilers implement
http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example
https://reviews.llvm.org/D49091

Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
recommend defining '__has_foo(x) 0' as a fallback for compilers without the
macros, so that's what we go for.

Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767
Reviewed-by: Alex Richardson <arichardson.kde@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-10 00:48:07 +01:00
Marc Mutz
333b1e9229 QReadWriteLock: add a check for writeOnly, too
Results on my machine:

  PASS   : tst_QReadWriteLock::writeOnly(QMutex)
  RESULT : tst_QReadWriteLock::writeOnly():QMutex:
     3,607 msecs per iteration (total: 3,607, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(QReadWriteLock)
  RESULT : tst_QReadWriteLock::writeOnly():QReadWriteLock:
     39,703 msecs per iteration (total: 39,703, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(std::mutex)
  RESULT : tst_QReadWriteLock::writeOnly():std::mutex:
     3,697 msecs per iteration (total: 3,697, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(std::shared_mutex)
  RESULT : tst_QReadWriteLock::writeOnly():std::shared_mutex:
     5,727 msecs per iteration (total: 5,727, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(std::shared_timed_mutex)
  RESULT : tst_QReadWriteLock::writeOnly():std::shared_timed_mutex:
     5,921 msecs per iteration (total: 5,921, iterations: 1)

(the 'nothing' test of course doesn't work with writing, as writing to
the same QString from different threads is UB)

Change-Id: Ia78b54963a51eaf6563ce0d243316a3337056a83
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-12 06:38:42 +02:00
Marc Mutz
72259e7186 Brush up QReadWriteLock benchmark
- add override
- tests C++17 shared_mutex in addition to C++14 shared_timed_mutex
- replace manual memory management with unique_ptr

Change-Id: If52df2097a4b92c10df4a7cdbb1c506d64b673e3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-12 06:38:23 +02:00
Edward Welbourne
acd7259a03 Extend QDate's benchmark
Test more methods.
Document what the existing test covers.
Use the right #include for QDate.

Change-Id: I051542c244e5bc381aafa3ae38144e246919db7a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:22:07 +02:00
Edward Welbourne
14aa481614 Convert foreach to ranged for in QDateTime benchmark
Change-Id: I05cf7b1916afa94a9f0f9b83af9b4ebe20a04cf0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:09:59 +02:00
Edward Welbourne
0556366ddb Deduplicate list-building code in QDateTime benchmark
Aside from the start-date and the end-date, and a variant with a
time-zone, the lists various tests were building were all built the
same way; so pack that up as a pair of functions (one without
time-zone, one with) to save duplication. Make the list in each
function const, ready for conversion of foreach loops to ranged for.

In the process, replace QList with QVector, reserve space before we
populate and use auto for the now-const list variables it's saved in.

Change-Id: I7d8cce459a4d6111cd645e8d3966ad769ab7e201
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:09:36 +02:00
Edward Welbourne
54f6c9bfd9 Fix unused variable warnings in QDateTime benchmark
Change-Id: Id123ace74cfa7b5ff406eabbfda0aad9f58c3fd4
Reviewed-by: David Faure <david.faure@kdab.com>
2019-08-30 10:55:46 +02:00
Edward Welbourne
06f69700af Fix some bogus date calculations in QDateTime's benchmark
Multiplying a Julian Day number by the number of milliseconds per day
does not get you a time since the start of 1970; it gets you a time
since the start of the Julian Day number system, which was several
millennia earlier.

Change-Id: Ic90a6c3de445baf9cfd30f28dd847f146e6a7adf
Reviewed-by: David Faure <david.faure@kdab.com>
2019-08-30 10:55:12 +02:00
Marc Mutz
ca5fc087bd Re-apply 'Skip old benchmark that doesn't build automatically'
This commit re-applies commit f8efe8e0c9,
which was lost in the recent tools → text changes.

Change-Id: I03ce35fcb89840e5607776d67578fb75b66f6eb2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-07-24 07:45:59 +03:00
Edward Welbourne
a9aa206b7b Move text-related code out of corelib/tools/ to corelib/text/
This includes byte array, string, char, unicode, locale, collation and
regular expressions.

Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 17:05:30 +02:00
Mårten Nordheim
16158e1132 Win: qdiriterator bench: fix missing null-terminator issues
It's not done by toWCharArray. This caused some issues as we were using
API requiring a null-terminator. wcslen for instance was measuring the
string as being millions of characters long, causing fairly quick
crashes when appending.

Change-Id: Iedaaf9f195be22a610543ab649da92a87cb71973
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-10 07:18:05 +00:00
Sona Kurazyan
ff2b2032a0 Remove usages of deprecated APIs from QtAlgorithms
Task-number: QTBUG-76491
Change-Id: I9dab736a0cbd2e86588919640c26e8ce6b3674d0
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-06-29 21:58:36 +02:00
Giuseppe D'Angelo
3e75c2965c Remove QLatin1Literal usages
That's an undocumented Qt 4/3/2 remnant, start remove usages.

Fix incorrect include header in qclass_lib_map.h as a drive-by.

Change-Id: I939be2621bc03e5c75f7e3f152546d3af6d37b91
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-10 16:50:31 +00:00
Edward Welbourne
548513a4bd Separate out the time, zone, date code from corelib/tools/
We'll be adding calendar code here as well, and tools/ was getting
rather crowded, so it looks like time to move out a reasonably
coherent sub-bundle of it all.

Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-06 15:54:32 +02:00
Edward Welbourne
7efce5d510 Add a bench-mark for QDate's isValid() and daysInMonth()
The two perform related calculations, so test them together.
RESULT : tst_QDate::monthLengths():
     0.33 msecs per iteration (total: 87, iterations: 256)

Change-Id: I86b36a9182b00c0a1f40e858ed3e7812434974c4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-22 15:07:32 +02:00
Milian Wolff
58b4e07369 Optimize QTimer::singleShot(0, ...) when taking PMF or Functor callable
QTimer::singleShot is optimized for zero timeouts when using the API
taking a string method name. This optimization was not used for the API
taking a PMF or functor. This patch adds it, making the various API
calls behave similarly from a performance point of view.

The approach taken here requires a QObject context object. If none is
available, e.g. a nullptr was passed explicitly, or the
QTimer::singleShot(O, Functor) API was used, the optimization could
not easily be applied. This is not only bad from a performance POV,
but also poses as a potential source for heisenbugs: Using the
different API versions of QTimer::singleShot would use different code
paths internally, which then would not ensure the expected slot call
order. This problem actually existed already when mixing the
string-based slot syntax with PMF/functors in the QTimer::singleShot
API.

This patch overcomes this hurdle and fixes all of the above: When we
encounter a 0ms single shot timer, and no QObject context object is
available, we fall back to the main thread, or create a temporary
QObject for any other thread. The updated and extended benchmark
shows that this is still a significant performance improvement
over using a timer:

********* Start testing of qtimer_vs_qmetaobject *********
Config: Using QtTest library 5.14.0, Qt 5.14.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 8.2.1 20181127)
PASS   : qtimer_vs_qmetaobject::initTestCase()
PASS   : qtimer_vs_qmetaobject::bench(singleShot_slot)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_slot":
     7.48 msecs per iteration (total: 748, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_pmf)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_pmf":
     7.20 msecs per iteration (total: 720, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_functor)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_functor":
     6.79 msecs per iteration (total: 679, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_functor_noctx)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_functor_noctx":
     6.92 msecs per iteration (total: 693, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_string)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_string":
     7.34 msecs per iteration (total: 735, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_pmf)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_pmf":
     6.90 msecs per iteration (total: 690, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_functor)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_functor":
     6.62 msecs per iteration (total: 662, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_slot)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_slot":
     7.45 msecs per iteration (total: 745, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_pmf)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_pmf":
     7.46 msecs per iteration (total: 747, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_functor)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_functor":
     6.70 msecs per iteration (total: 671, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_functor_noctx)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_functor_noctx":
     13.75 msecs per iteration (total: 1,376, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(invokeMethod_string)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"invokeMethod_string":
     7.05 msecs per iteration (total: 706, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(invokeMethod_pmf)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"invokeMethod_pmf":
     6.70 msecs per iteration (total: 670, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(invokeMethod_functor)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"invokeMethod_functor":
     6.58 msecs per iteration (total: 658, iterations: 100)
PASS   : qtimer_vs_qmetaobject::cleanupTestCase()
Totals: 16 passed, 0 failed, 0 skipped, 0 blacklisted, 20977ms
********* Finished testing of qtimer_vs_qmetaobject *********

Without the change to qtimer.cpp, the results are:

********* Start testing of qtimer_vs_qmetaobject *********
Config: Using QtTest library 5.14.0, Qt 5.14.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 8.2.1 20181127)
PASS   : qtimer_vs_qmetaobject::initTestCase()
PASS   : qtimer_vs_qmetaobject::bench(singleShot_slot)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_slot":
     7.45 msecs per iteration (total: 745, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_pmf)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_pmf":
     112.84 msecs per iteration (total: 11,285, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_functor)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_functor":
     115.62 msecs per iteration (total: 11,563, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_functor_noctx)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_functor_noctx":
     110.81 msecs per iteration (total: 11,082, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_string)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_string":
     7.04 msecs per iteration (total: 704, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_pmf)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_pmf":
     6.62 msecs per iteration (total: 662, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_functor)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_functor":
     6.62 msecs per iteration (total: 662, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_slot)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_slot":
     7.45 msecs per iteration (total: 746, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_pmf)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_pmf":
     118.42 msecs per iteration (total: 11,842, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_functor)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_functor":
     119.35 msecs per iteration (total: 11,936, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(singleShot_functor_noctx)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"singleShot_functor_noctx":
     130.96 msecs per iteration (total: 13,096, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(invokeMethod_string)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"invokeMethod_string":
     8.08 msecs per iteration (total: 808, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(invokeMethod_pmf)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"invokeMethod_pmf":
     6.79 msecs per iteration (total: 680, iterations: 100)
PASS   : qtimer_vs_qmetaobject::benchBackgroundThread(invokeMethod_functor)
RESULT : qtimer_vs_qmetaobject::benchBackgroundThread():"invokeMethod_functor":
     7.49 msecs per iteration (total: 749, iterations: 100)
PASS   : qtimer_vs_qmetaobject::cleanupTestCase()
Totals: 16 passed, 0 failed, 0 skipped, 0 blacklisted, 153995ms
********* Finished testing of qtimer_vs_qmetaobject *********

Additionally, this patch adds a unit test to verify that the slot call
order for 0ms single shot timers is followed while mixing the various
API versions. It fails without this patch but passes now.

Finally, another test is added to verify that using QTimer::singleShot
before a QCoreApplication was constructed is still working properly.

Change-Id: I0d6211554b6198cb3e527be9ec3adc572b1b54ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-06 21:16:56 +00:00
Allan Sandfeld Jensen
5c90a96998 Remove handling of missing Q_COMPILER_CLASS_ENUM
Change-Id: I1fd6d601e49e803b4c3308fb0ca41136c628afbc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-06 16:19:14 +00:00
Milian Wolff
4413f7070a Enable and extend the qtimer_vs_qmetaobject benchmark
This benchmark was not compiled, and it only covered some parts of the
API. Enable it, and also measure the performance of PMF and Functor API
variants, for both QTimer::singleShot and QMetaObject::invokeMethod.

This uncovers that the zero-timeout optimization for the singleShot is
not applied to the PMF and Functor API variants:

********* Start testing of qtimer_vs_qmetaobject *********
Config: Using QtTest library 5.11.0, Qt 5.11.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.2.1 20171224)
PASS   : qtimer_vs_qmetaobject::initTestCase()
PASS   : qtimer_vs_qmetaobject::bench(singleShot_slot)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_slot":
     5.20 msecs per iteration (total: 520, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_pmf)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_pmf":
     75.93 msecs per iteration (total: 7,594, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_functor)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_functor":
     77.90 msecs per iteration (total: 7,790, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(singleShot_functor_noctx)
RESULT : qtimer_vs_qmetaobject::bench():"singleShot_functor_noctx":
     76.23 msecs per iteration (total: 7,624, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_string)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_string":
     4.99 msecs per iteration (total: 499, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_pmf)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_pmf":
     5.37 msecs per iteration (total: 538, iterations: 100)
PASS   : qtimer_vs_qmetaobject::bench(invokeMethod_functor)
RESULT : qtimer_vs_qmetaobject::bench():"invokeMethod_functor":
     4.74 msecs per iteration (total: 474, iterations: 100)
PASS   : qtimer_vs_qmetaobject::cleanupTestCase()
Totals: 9 passed, 0 failed, 0 skipped, 0 blacklisted, 50220ms
********* Finished testing of qtimer_vs_qmetaobject *********

Change-Id: I46336613188317124804638627f07eb135dc0286
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-03-27 06:37:33 +00:00
Qt Forward Merge Bot
67c70b22f6 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ifa143cc462301aaa305c9c85360e543553a751f0
2019-02-19 01:00:08 +01:00
Joerg Bornemann
8fe3680193 Add cmdline feature to qmake
[ChangeLog][qmake] A new feature "cmdline" was added that implies
"CONFIG += console" and "CONFIG -= app_bundle".

Task-number: QTBUG-27079
Change-Id: I6e52b07c9341c904bb1424fc717057432f9360e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2019-02-18 07:12:14 +00:00
Christian Ehrlicher
7c69f6171d QFile/QFileInfo: mark readLink() as deprecated
QFile/QFileInfo::readLink() functions are obsolete but were not marked
as deprecated.
Explicit mark them as deprecated so they can be removed with Qt6.

Change-Id: I52424dc5441e1f5b01015713df990bbec5186caa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-01-23 18:49:15 +00:00
Tobias Hunger
757d4b85a9 Benchmark: Add _bench_ into the name of the qmap benchmark
Change-Id: I6a1790981eb56d56bc190634e796bc3736ddd475
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-11-08 21:34:27 +00:00
Tobias Hunger
c99544a474 benchmarks: Fix copy and paste error in .pro-file
Change-Id: I30e4c640b9299559063b0337b6639d7c5a19e1db
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-11-08 21:34:08 +00:00
Friedemann Kleint
20a8a277ee tst_qfileinfo: Refactor ntfsJunctionPointsAndSymlinks()
Move the creation of the symbolic link/junction from the _data() slot
into the actual test function. The parameters are passed by a newly
introduced struct. This ensures only the symbolic links/junctions that
are actually needed are created. It can then no longer happen that
filtering for one data row invokes recursive deletion of the mountpoint
junction.

Also use of the newly introduced convenience createSymbolicLink()
in canonicalFilePath()

Task-number: QTBUG-63989
Change-Id: Ia78fd4ad6097136934ab5a375f4c352713d0f115
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-09-30 09:59:09 +00:00
Ivan Komissarov
09e926cc27 Use a std::vector instead of a QVector in QMimeDatabasePrivate
Using std::vector saves a bit c++ code when using range-for loop over
the vector.

Besides, no shared copies created anymore which is a bit faster.

Change-Id: I564306ed9ac907e9f32f59b33ed15c027a59b4eb
Reviewed-by: David Faure <david.faure@kdab.com>
2018-09-29 14:22:18 +00:00
Liang Qi
e3ed2281c0 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/cocoa/qnsview_dragging.mm
	src/plugins/platforms/ios/qiosinputcontext.mm
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	src/tools/androiddeployqt/main.cpp
		Was moved from qttools into qtbase in 5.11.
		So re-apply 32398e4d here.
	tests/auto/corelib/global/qlogging/test/test.pro
	tests/auto/corelib/global/qlogging/tst_qlogging.cpp
	tests/auto/corelib/io/qfile/tst_qfile.cpp
	tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
	tests/auto/corelib/thread/qthreadstorage/test/test.pro
	tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
	tests/auto/widgets/kernel/qapplication/test/test.pro

Done-with: Gatis Paeglis <gatis.paeglis@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Done-with: Oliver Wolff <oliver.wolff@qt.io>
Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
2018-07-02 11:23:45 +02:00
Edward Welbourne
d4a5ea2d4a tst_bench_QUuid: eliminate an unused variable
Fixes a warning while compiling.

Change-Id: I6d463d5ab6e95714fcf96a883577249593490380
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-06-14 09:15:06 +00:00
David Faure
46ec170d2b Speed up QTimeZone::isTimeZoneIdAvailable by a factor 43
Creating and sorting a list of bytearrays just to check if one entry is
present, is really overkill. By adding a new virtual method
isTimeZoneIdAvailable() in the backend classes, we can do this much more
efficiently.

Implemented for Utc and Tz backends, the others fall back to the
slow way.

The new benchmark shows, in release mode:
Before: 43 msecs per iteration (total: 86, iterations: 2)
After: 1.1 msecs per iteration (total: 73, iterations: 64)

Change-Id: Ic0d79a41d74e2ce6aa088fa7986c41d33902c36b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-04-23 06:48:12 +00:00
Kari Oikarinen
caa5a20479 Make a benchmark out of tst_QObjectPerformance::emitToManyReceivers
The test has been flaky on top of QEMU. The test is clearly a sort of manually
rolled benchmark, not a regular autotest. Remove the test and replace it with a
benchmark in QObjectBenchmark.

Task-number: QTBUG-66823
Task-number: QTBUG-66216
Change-Id: I7a48293023f32141eed6fea50fbb63af18933a8f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-03-07 19:43:52 +00:00
Kari Oikarinen
45bace2ff9 QObjectBenchmark: Don't try to set read-only properties
Avoid lots of warnings about not being able to set "modal".

Change-Id: I396718f14a55203f9989c03e20efc647c64795a9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-03-07 07:19:21 +00:00
Allan Sandfeld Jensen
2c25a431d0 Use dependencies instead of CONFIG+=ordered
Also drops a few instances where the dependency was purely runtime,
especially for examples.

Change-Id: I2a0476f79928143596bdb3b8f01193af90574ae8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-02 11:09:15 +00:00
Liang Qi
153e8b49ad Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/network/access/qhttp2protocolhandler_p.h
	src/network/kernel/kernel.pri
	src/network/ssl/qsslkey_qt.cpp
	src/plugins/platforms/cocoa/qcocoascreen.mm
	src/plugins/platforms/windows/accessible/iaccessible2.cpp
	src/plugins/platforms/windows/accessible/iaccessible2.h
	src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
	src/widgets/widgets/qmenu_p.h
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/other/qaccessibility/tst_qaccessibility.cpp
	tests/auto/testlib/selftests/expected_cmptest.lightxml
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/testlib/selftests/expected_cmptest.xml

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
2017-11-23 09:36:03 +01:00
Thiago Macieira
19b0ce5daa Change almost all other uses of qrand() to QRandomGenerator
The vast majority is actually switched to QRandomGenerator::bounded(),
which gives a mostly uniform distribution over the [0, bound)
range. There are very few floating point cases left, as many of those
that did use floating point did not need to, after all. (I did leave
some that were too ugly for me to understand)

This commit also found a couple of calls to rand() instead of qrand().

This commit does not include changes to SSL code that continues to use
qrand() (job for someone else):
  src/network/ssl/qsslkey_qt.cpp
  src/network/ssl/qsslsocket_mac.cpp
  tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-08 09:14:03 +00:00
Liang Qi
d0a0a3c041 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	examples/network/fortuneclient/client.cpp
	examples/network/fortuneserver/server.cpp
	src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
	src/plugins/platforms/cocoa/qcocoabackingstore.h
	src/plugins/platforms/cocoa/qcocoaintegration.h
	src/plugins/platforms/cocoa/qcocoascreen.h
	src/plugins/platforms/ios/qiosbackingstore.h
	src/plugins/sqldrivers/oci/qsql_oci.cpp
	src/widgets/kernel/qwidgetwindow.cpp

Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
2017-10-17 10:34:24 +02:00
Liang Qi
aadfe7d634 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/gui/kernel/qguiapplication.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/testlib/qtestsystem.h

Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
2017-09-26 16:14:54 +02:00
Thiago Macieira
92ca09147f Restore compatibility with pre-5.9 Keccak calculation
Commit 12c5264d9a fixed the calculation of
SHA-3 in QCryptographicHash: we were previously calculating Keccak.
Unfortunately, turns out that replacing the algorithm wasn't the best
idea: there are people who need to compare with the result obtained from
a previous version of Qt and stored somewhere. This commit restores the
enum values 7 through 10 to mean Keccak and moves SHA-3 to 12 through
15. The "Sha3_nnn" enums will switch between the two according to the
QT_SHA3_KECCAK_COMPAT macro.

[ChangeLog][Important Behavior Changes] This version of Qt restores
compatibility with pre-5.9.0 calculation of QCryptographicHash
algorithms that were labelled "Sha3_nnn": that is, applications compiled
with old versions of Qt will continue using the Keccak algorithm.
Applications recompiled with this version will use SHA-3, unless
QT_SHA3_KECCAK_COMPAT is #define'd prior to #include
<QCryptographicHash>.

[ChangeLog][Binary Compatibility Note] This version of Qt changes the
values assigned to enumerations QCryptographicHash::Sha3_nnn.
Applications compiled with this version and using those enumerations
will not work with Qt 5.9.0 and 5.9.1, unless QT_SHA3_KECCAK_COMPAT is
defined.

Task-number: QTBUG-62025
Discussed-at: http://lists.qt-project.org/pipermail/development/2017-September/030818.html
Change-Id: I6e1fe42ae4b742a7b811fffd14e418fc04f096c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-21 03:21:58 +00:00
Kevin Funk
47c92fbb0b Replace Q_DECL_OVERRIDE with override where possible
Remaining uses of Q_DECL_OVERRIDE are in:

src/corelib/global/qcompilerdetection.h
src/corelib/global/qglobal.cpp
doc/global/qt-cpp-defines.qdocconf
  (definition and documentation of Q_DECL_OVERRIDE)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:42 +00:00
Jake Petroules
2740b9d668 Use QT_LSTAT instead of lstat directly
Not all platforms (such as VxWorks) have lstat.

Change-Id: If42f0041f9a6d9bec0a355173c88f28f1819bd57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-15 20:52:23 +00:00
Kai Koehne
b2efaeba79 tests: Unify license to GPL-EXCEPT
Change-Id: Ic718650a8a7bddd4ee28c5650a3f5baf70886e51
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-04-03 07:18:46 +00:00
Ulf Hermann
44af54419e Properly use the "process" feature
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.

Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-27 15:44:46 +00:00
Alex Trotsenko
6e8fcab7e0 Improve QIODevice::peek() performance on buffered devices
Since 5.7, QIODevice::peek() implementation is based on transaction
mechanism. While technically it's correct, seeking backward on a
buffered random-access device clears the internal buffer that affects
the performance of reading.

To solve the problem, this patch implements peek mode directly inside
the reading procedure.

Task-number: QTBUG-56032
Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-09 18:46:24 +00:00
David Faure
a8ae8e3130 QDateTime::fromString(): improve performance by 33%
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.

tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
 RESULT : tst_QDateTime::fromString():
-     36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+     24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)

Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-03 13:37:49 +00:00
Olivier Goffart
5699530758 Add a benchmark for QReadWriteLock
Results on current dev branch [955b2bdfc0]:

thread count: 4
********* Start testing of tst_QReadWriteLock *********
Config: Using QtTest library 5.8.0, Qt 5.8.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 6.1.1 20160707)
PASS   : tst_QReadWriteLock::initTestCase()
PASS   : tst_QReadWriteLock::uncontended(nothing)
RESULT : tst_QReadWriteLock::uncontended():"nothing":
     1,113,292.1 CPU ticks per iteration (total: 11,132,922, iterations: 10)
PASS   : tst_QReadWriteLock::uncontended(QMutex)
RESULT : tst_QReadWriteLock::uncontended():"QMutex":
     35,490,310.7 CPU ticks per iteration (total: 354,903,108, iterations: 10)
PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, read)
RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, read":
     40,513,695.0 CPU ticks per iteration (total: 405,136,950, iterations: 10)
PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, write)
RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, write":
     43,179,327.2 CPU ticks per iteration (total: 431,793,272, iterations: 10)
PASS   : tst_QReadWriteLock::uncontended(std::mutex)
RESULT : tst_QReadWriteLock::uncontended():"std::mutex":
     37,733,243.0 CPU ticks per iteration (total: 377,332,430, iterations: 10)
PASS   : tst_QReadWriteLock::uncontended(std::shared_timed_mutex, read)
RESULT : tst_QReadWriteLock::uncontended():"std::shared_timed_mutex, read":
     71,517,438.7 CPU ticks per iteration (total: 715,174,388, iterations: 10)
PASS   : tst_QReadWriteLock::uncontended(std::shared_timed_mutex, write)
RESULT : tst_QReadWriteLock::uncontended():"std::shared_timed_mutex, write":
     69,967,867.5 CPU ticks per iteration (total: 699,678,676, iterations: 10)
PASS   : tst_QReadWriteLock::readOnly(nothing)
RESULT : tst_QReadWriteLock::readOnly():"nothing":
     479,393,335.3 CPU ticks per iteration (total: 4,793,933,354, iterations: 10)
PASS   : tst_QReadWriteLock::readOnly(QMutex)
RESULT : tst_QReadWriteLock::readOnly():"QMutex":
     823,493,383.2 CPU ticks per iteration (total: 8,234,933,832, iterations: 10)
PASS   : tst_QReadWriteLock::readOnly(QReadWriteLock)
RESULT : tst_QReadWriteLock::readOnly():"QReadWriteLock":
     559,816,053.6 CPU ticks per iteration (total: 5,598,160,536, iterations: 10)
PASS   : tst_QReadWriteLock::readOnly(std::mutex)
RESULT : tst_QReadWriteLock::readOnly():"std::mutex":
     961,903,416.3 CPU ticks per iteration (total: 9,619,034,164, iterations: 10)
PASS   : tst_QReadWriteLock::readOnly(std::shared_timed_mutex)
RESULT : tst_QReadWriteLock::readOnly():"std::shared_timed_mutex":
     1,786,254,363.5 CPU ticks per iteration (total: 17,862,543,636, iterations: 10)
PASS   : tst_QReadWriteLock::cleanupTestCase()
Totals: 14 passed, 0 failed, 0 skipped, 0 blacklisted, 44507ms
********* Finished testing of tst_QReadWriteLock *********

Change-Id: I42189f7a356dcb36378e9d54111b7fbe89e62402
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-10 09:05:14 +00:00
Robin Burchell
57413ad3f6 QMetaType: Add a benchmark covering creation of QVariant from an enum
This proved to be quite slow in the past due to QReadWriteLock's implementation
being suboptimal (prior to its improvement in
343e5d066a).

This codepath is exercised quite extensively by QML with enum registrations.

Change-Id: I94d1e13933bf005604dc4494e2cb5bc25ef3d387
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-22 12:47:05 +00:00
Liang Qi
511790fd1a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	mkspecs/features/uikit/sdk.prf
	src/corelib/global/qhooks.cpp
	src/corelib/io/qfilesystemwatcher.cpp
	src/corelib/io/qlockfile_unix.cpp
	src/corelib/tools/qalgorithms.h
	src/gui/kernel/qwindowsysteminterface.h
	src/gui/text/qtextdocument_p.cpp
	src/network/access/access.pri
	src/network/access/qnetworkaccessmanager.cpp
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/src.pro
	src/testlib/qtestcase.cpp
	src/widgets/kernel/qwidgetbackingstore_p.h
	src/widgets/styles/qwindowscestyle.cpp
	src/widgets/styles/qwindowsmobilestyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
	tools/configure/configureapp.cpp

Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
2016-06-13 12:46:46 +02:00
Thiago Macieira
0a78d918f0 Replace qAllocMore with a pair of more useful functions
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.

The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.

Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-09 15:32:14 +00:00
Liang Qi
6357813207 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	src/3rdparty/double-conversion/include/double-conversion/utils.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/tools/qsimd_p.h
	tests/auto/corelib/io/qfile/tst_qfile.cpp

Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
2016-05-03 15:49:15 +02:00
Allan Sandfeld Jensen
f8efe8e0c9 Skip old benchmark that doesn't build automatically
This benchmark requires QtScript1 headers, and can not build as is.

Change-Id: I98e57ca2db82270a0887462d7959ff00e352166b
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-04-13 12:23:06 +00:00
Liang Qi
f285687584 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	examples/corelib/ipc/ipc.pro
	src/plugins/platforms/xcb/qxcbbackingstore.cpp
	tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp

Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
2016-04-05 14:22:45 +02:00