summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
Commit message (Collapse)AuthorAgeFilesLines
...
* Adapt corelib to use QTimeZone in place of Qt::TimeSpecEdward Welbourne2022-12-092-8/+8
| | | | | | | | | This saves (mostly in corelib/time/) some complications that used to arise from needing different code-paths for different time-specs. Task-number: QTBUG-108199 Change-Id: I5dbd09859fce7599f1ba761f8a0bfc4633d0bef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add In-place utf-8 case-insensitive comparisonsØystein Heskestad2022-12-023-0/+278
| | | | | | | | | | | Also add optimizations for more string comparisons and add tests and benchmarks. [ChangeLog][QtCore][QString] Added utf-8 case-insensitive comparisons Fixes: QTBUG-100235 Change-Id: I7c0809c6d80c00e9a5d0e8ac3ebb045cf7004a30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add benchmarks for QLocale number parsingEdward Welbourne2022-11-111-0/+230
| | | | | | | | | Based on those for QString, but with locale variation and exercising some of the locales with multi-character signs and exponents. Pick-to: 6.4 6.2 5.15 Change-Id: Id0253449f9abcc154285f89337aa0e26dd69900d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add benchmarks for QString number parsingEdward Welbourne2022-11-111-8/+164
| | | | | | | | | | | Based on the tests for QString::number(), but run in reverse, with some embelishments. Also moved some shared code from number_*_data() to their shared number_integer_common template. Pick-to: 6.4 6.2 5.15 Change-Id: I74e7082372166c3cdbcd6bcbc31f9003e07cbcbc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-034-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tests: fix configuring with -no-feature-guiJohannes Kauffmann2022-10-291-3/+2
| | | | | | Pick-to: 6.2 6.4 Change-Id: I99765d38c9c37f1fe17b15f7736e4c78c7ffac20 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* benchmarks: fix configuring with -no-feature-sqlJohannes Kauffmann2022-10-251-1/+3
| | | | | | | | | | With -no-feature-sql, CMake would error out because the target Qt6::Sql didn't exist. Fix this by checking if the target exists. Task-number: QTBUG-102480 Pick-to: 6.2 6.3 6.4 Change-Id: I411631acfd336ea699833954f86711067d160c04 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Windows: bump NTDDI_VERSION to latest version and remove some duplicated codeYuhang Zhao2022-10-241-3/+0
| | | | | | | | | | | | | | | We have NTDDI_WIN10_NI (0x0A00000C) in the Win11 SDK (10.0.22621) so bump the value in Qt (currently 0x0A00000B) to it. And when searching for _WIN32_WINNT/WINVER/NTDDI_VERSION throughout the whole qtbase codebase, I found some duplicated code, mostly leftovers from the legacy time. Replace them with our own windows header can achieve the same effect: we have defined all the necessary macros to unblock the latest features. And place the header at the top most place to include the macros as early as possible. Change-Id: I37d9ac40ca9748208c7b2e89f374eda362dbefd6 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Long live Q_UNREACHABLE_RETURN()!Marc Mutz2022-10-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a combination of Q_UNREACHABLE() with a return statement. ATM, the return statement is unconditionally included. If we notice that some compilers warn about return after __builtin_unreachable(), then we can map Q_UNREACHABLE_RETURN(...) to Q_UNREACHABLE() without having to touch all the code that uses explicit Q_UNREACHABLE() + return. The fact that Boost has BOOST_UNREACHABLE_RETURN() indicates that there are compilers that complain about a lack of return after Q_UNREACHABLE (we know that MSVC, ICC, and GHS are among them), as well as compilers that complained about a return being present (Coverity). Take this opportunity to properly adapt to Coverity, by leaving out the return statement on this compiler. Apply the macro around the code base, using a clang-tidy transformer rule: const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule( stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)) ); where nextStmt() is copied from some upstream clang-tidy check's private implementation and subStmt() is a private matcher that gives access to SwitchCase's SubStmt. A.k.a. qt-use-unreachable-return. There were some false positives, suppressed them with NOLINTNEXTLINE. They're not really false positiives, it's just that Clang sees the world in one way and if conditonal compilation (#if) differs for other compilers, Clang doesn't know better. This is an artifact of matching two consecutive statements. I haven't figured out how to remove the empty line left by the deletion of the return statement, if it, indeed, was on a separate line, so post-processed the patch to remove all the lines matching ^\+ *$ from the diff: git commit -am meep git reset --hard HEAD^ git diff HEAD..HEAD@{1} | sed '/^\+ *$/d' | recountdiff - | patch -p1 [ChangeLog][QtCore][QtAssert] Added Q_UNREACHABLE_RETURN() macro. Change-Id: I9782939f16091c964f25b7826e1c0dbd13a71305 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-116-13/+13
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-043-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update tst_bench_qhash hash functions to use size_tMårten Nordheim2022-09-272-10/+10
| | | | | | | | | | | Pre-requisite for a fix for qHash. The Qt50String inherits from QString and becomes ambiguous once it no longer goes through a catch-all template function because qHash(QString, size_t) has a better match for the second argument. Pick-to: 6.2 6.4 Change-Id: I23c7afb1b3aa167d40dc4838e82b7763de015f6b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QDir_10000: add sorted_byName benchmarkMarc Mutz2022-08-261-0/+9
| | | | | | Pick-to: 6.4 6.3 6.2 Change-Id: Ic30a6353c356f6613f2ef3720b99ebb3b0a7968e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-23145-145/+145
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Update QTimeZone benchmark's list of tested zonesEdward Welbourne2022-08-161-9/+16
| | | | | | | | | | | It purports to be a list of those named in QDateTime's tests, but was a bit out of date. In the process, sort them into somewhat coherent order (to make it easier to verify whether one is missing next time I check) and reformat. Pick-to: 6.4 6.3 6.2 Change-Id: I16e7ded6f8b00e226513bd06d6174a79f7a0c675 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-03145-0/+435
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-28110-116/+116
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* tst_tostring: add benchmarks for QCOMPARE vs. QCOMPARE_EQMarc Mutz2022-06-221-0/+55
| | | | | | | | | | | | | | There's currently no statistically-significant difference between the two, due to a huge pessimistion in QTestLib where every QCOMPARE* and QVERIFY writes 1KiB of data onto the stack before doing anything else, so I'm not reporting numbers in this commit message. Pick-to: 6.4 Task-number: QTBUG-98873 Task-number: QTBUG-98874 Change-Id: I233878596f0a8fe6b96360adb839fecd72c398a2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_bench_shared_ptr: fix build with BOOST_NO_EXCEPTIONSMarc Mutz2022-06-221-0/+13
| | | | | | | | | | | | | | | | | If, for whatever reason, BOOST_NO_EXCEPTIONS is defined, the user of the Boost libraries is supposed to provide a definition of boost::throw_exception, which we didn't. We used to run into this only on ubsan builds, but it seems we now have the problem on a regular Ubuntu 22.04 build, too (cf. bugreport). Fix by adding the necessary definitions. Fixes: QTBUG-104083 Pick-to: 6.4 6.3 Change-Id: I9b061a158a5b77e8d286bd7b40312e5bc63ee8de Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix typos in docs and commentsKai Köhne2022-06-151-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make two QDT benchmarks data-driven and add more rowsEdward Welbourne2022-06-151-60/+40
| | | | | | | | | | | | | | | | | | The QDateTime benchmark's toMSecsSinceEpoch() and toMSecsSinceEpochTz() each iterated the 2010s and had 1950 and 2050 variants for two other decades. I want to also test some earlier decades and do similar for create(), so combine the existing triplets as three rows of a data-driven test for each triplet, add the new rows and apply the same to create(). In the process, turn an enum used for qint64 constants into a set of constexpr qint64 declarations. Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-104012 Change-Id: I2657346b65d96a7ef7503cd33c870b688ea5dbff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTest::toString benchmark: do not pass a template type parameterGiuseppe D'Angelo2022-06-041-1/+1
| | | | | | | | Let it to be deduced, otherwise it may force instantiations which are ill-formed. Change-Id: I3ce674128d96a48ad6883e265734ff330645dd75 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QTextDocument: add setLayoutEnabled()David Faure2022-05-261-0/+19
| | | | | | | | | | | | This allows to set up everything first - without paying for the layout calculation at every step - and only then trigger the layout once. Results: 0.065 msecs to create a QGraphicsTextItem with some text (layouted) 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width Change-Id: I138bd1d58941d029bc0a36d2730216778f1fbd97 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix crash in tst_qquicktext::implicitSizeEskil Abrahamsen Blomfeldt2022-05-201-37/+0
| | | | | | | | | | | | | This reverts commit 1e938c348b936328fafbcaae4c0c7d91003143e5 and bb2f4d08d9d138e4f70d6d6db46e24e34500becc. bb2f4d08d9d causes the crash, but 1e938c348b93 amends it, so this reverts both. When the cause of the crash has been determined and mitigated, the patches can be recreated. Fixes: QTBUG-103719 Change-Id: Ifc36b3771a96f6c85387a5306a0402d4c508d006 Reviewed-by: David Faure <david.faure@kdab.com>
* QTextDocument: add setLayoutEnabled()David Faure2022-05-191-0/+18
| | | | | | | | | | | This allows to set up everything first - without paying for layouting at every step - and only then trigger layouting. Same performance behavior as setTextWidth(0), but this is a more explicit/readable API. Change-Id: I044dbd8b1301b1c97a92f9a29ccde2baf27a7665 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTextDocument/QGraphicsTextItem: skip layout in setTextWidth(0)David Faure2022-05-171-0/+19
| | | | | | | | | | | | | | | | | | In a QGraphicsTextItem without a width yet, there's no need to do any layouting. The use case is obviously items with an app-defined size, not the default where text items adapt to their contents. Results: 0.065 msecs to create a QGraphicsTextItem with some text (layouted) 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width QTextEdit was abusing the width 0 to mean "no wrap, width comes from contents", but since the value -1 means that already in QTextDocument, QTextEdit now uses a width of -1 for that meaning. Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-16201-5432/+407
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QWidgetTextControl: port to new-style connects (faster)David Faure2022-05-101-0/+11
| | | | | | | | | | | | | | | This speeds up creating a QGraphicsTextItem by 14% in an optimized build Before: 0.070 msecs per iteration After: 0.060 msecs per iteration Those connects were showing up when profiling, because of the string parsing that is necessary when using SIGNAL/SLOT macros. The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString() => QArgumentType constructor => qMetaTypeInternal(const char*). Pick-to: 6.3 6.2 5.15 Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* benchmarks: fix deprecation warningsMarc Mutz2022-04-062-5/+5
| | | | | | | | | - count() -> size() - QCryptographicHash::addData(ptr, ch) -> ({ptr, ch}) (QByteArrayView overload) Pick-to: 6.3 Change-Id: I15dddfa5c4385dd2a0fa0c3ae06c303c7151e2dc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* More startOfDay() fixes, in tst_bench_QDateTimeEdward Welbourne2022-03-311-4/+5
| | | | | | | | | | | Update a QDateTime benchmark to use QDate::startOfDay() when setting up its lists of date-times in helper functions, and to use noon as the moment in the day in a creation test. Also move creation of a QTime outside the loop: we're testing speed of creation of QDateTime here, not QTime (and were already using the most trivial QTime constructor). Change-Id: I26bf3369aae84a802ab03791f7341e107fede87c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix lancebench after lancelot restructuringAllan Sandfeld Jensen2022-03-171-1/+1
| | | | | | Pick-to: 6.3 6.2 Change-Id: I5e17230761ca5482b3376787afab29d15de58dac Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Benchmarks: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | Change-Id: I1d0dbfca130f43d76de2d6ac585a0f242d490b5a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Tests: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+2
| | | | | Change-Id: Ibc6a948480a904913a5427e6408d4d296784fb4f Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QByteArray benchmark: fix clang -Wmove-resultMarc Mutz2022-01-241-1/+1
| | | | | | | | | | | | | | | | | Take the argument by value instead of rvalue ref. In C++17, this is as efficient, and enables the return big; to use the QByteArray move constructor, avoiding the need for a manual std::move(), which always looks suspicious on a return statement, because more often than not, it's a pessimization that breaks NRVO. This code doesn't seem to exist in Qt 6.2, so only Pick-to: 6.3 Change-Id: I8bf678102f5df1870cfc61090d12f327478d74d1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* benchmarks: fix some (future) -Wunused-result warningsMarc Mutz2022-01-243-28/+28
| | | | | | | | | | | | | | | | | | | | Clang 10 warns about unused results of relational operators, which is where this is coming from. Fix by adding the usual prefix [[maybe_unused]] auto r = ~~~; to silence the warning. Do this elsewhere, too, since [[nodiscard]] is slowly being rolled out across all our APIs. This is not a complete sweep, though. Not picking to 5.15, because this pattern doesn't work there and I don't want to introduce a new one. Pick-to: 6.3 6.2 Change-Id: I40dd8ad07496b686979dce533e044cbb486e30f3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_bench_qlocalsocket: fix Clang 10 warnings about unneeded captureMarc Mutz2022-01-241-2/+1
| | | | | | | | | | | | | | | | The timeToTest constant doesn't need to be captured, claims Clang. Since I don't recall seeing this warning on GCC, be pragmatic and fix by letting the compiler choose what to capture: [&]. timeToTest is const, so it doesn't matter whether we capture by reference or value, the lambda cannot change it either way. This code doesn't seem to exist in 5.15, so merely Pick-to: 6.3 6.2 Change-Id: I48d42ab13ed22ac5eb512dc61235b72a19636ea3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTransform benchmark: measure what was promisedMarc Mutz2022-01-241-1/+1
| | | | | | | | | | | | The function name suggests that the *= operator is to be benchmarked, not simple multiplication. Use the correct operator. Pick-to: 6.3 6.2 5.15 Change-Id: I6718e8aea640a153083858b39963199e7bab26e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use QPromise when creating continuations to avoid memory leaksSona Kurazyan2022-01-211-0/+1
| | | | | | | | | | | | | | | | | Continuations were using QFutureInterface to create and return the associated future to the user. Attaching a continuation to the returned future could cause memory leaks (described in an earlier commit). Use a QPromise when saving the continuation, to make sure that the attached continuation is cleaned in the destructor of the associated QPromise, so that it doesn't keep any ref-counted copies to the shared data, thus preventing it from being deleted. Task-number: QTBUG-99534 Pick-to: 6.3 6.2 Change-Id: I52d5501292095d41d1e060b7dd140c8e5d01335c Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Baseline: Move the paintcommands code into the shared directoryVolker Hilsheimer2022-01-201-2/+2
| | | | | | | | | It's used by the lancebench and the lance tool, and it will probably be useful for writing some high-dpi related unit and baseline test cases, so move it to the shared folder. Change-Id: I969bab51c9504be13b4c192b4f29f69cd9102868 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-172-94/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix the benchmark for QList::removeAll()Sona Kurazyan2021-12-091-92/+25
| | | | | | | | | | | | | | | | | The benchmark was making assumptions about number of constructor/assignment operator calls, which are not valid in Qt 6, after the implementation of QList has changed. Considering that we already check number of constructions, copy constructions, etc., in tst_qlist.cpp, remove the checks from the benchmark. As a driveby, fix the following warning: "warning: parameter 'i' shadows member inherited from type 'MyBase'" Pick-to: 6.2 Fixes: QTBUG-95096 Change-Id: Ida68fa5803641c8fa84f8309c0093986ed4c0a2b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Optimize QMimeDatabase::mimeTypeForFile(f, MatchDefault)Igor Kushnir2021-12-067-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Open the file only if matching on content is needed. Use QFileInfo::filePath() instead of QFileInfo::absoluteFilePath() in QMimeDatabase::mimeTypeForFile(). filePath() does much less work, and so is faster. Thiago Macieira helpfully explained in a review comment why the absolute path is not useful for correctness here: "Nothing needs absolute paths within the same application that would resolve the relative path to absolute. You only need an absolute path if you're communicating with another application that may be in a different directory." QMimeDatabase::mimeTypeForFile() checks fileInfo.isDir(), so the fileName.endsWith(QLatin1Char('/')) check in QMimeDatabasePrivate::mimeTypeForFileNameAndData() was redundant when called from this function. The other two callers of that function now check this condition before opening IO devices. This improves performance of the two QMimeDatabase::mimeTypeForFileNameAndData() overloads in the corner case. Refactor and optimize QMimeDatabasePrivate::findByFileName() and its usages. Previously each caller constructed a QFileInfo object and passed QFileInfo::fileName() into this function. Now the callers simply pass an absolute or relative path to a file into this function, which then uses QFileSystemEntry::fileName() to exclude the path. Constructing QFileInfo is relatively expensive, so this change slightly improves performance. Optimize QMimeDatabasePrivate::loadProviders() by calling static QFileInfo::exists() instead of constructing a QFileInfo object and calling the non-static QFileInfo::exists() overload. Note that the QFileInfo object was always created, even if QFileInfo::exists() under an `if` and an `#if` was never called. The following table contains the average results of the added benchmark tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before and at this commit. The numbers denote milliseconds per iteration. data row tag before at MatchDefault: archive 0.029 0.016 OpenDocument Text 0.029 0.015 existent archive with extension 0.039 0.025 existent C with extension 0.033 0.020 existent text file with extension 0.033 0.020 existent C w/o extension 0.076 0.074 existent patch w/o extension 0.11 0.105 existent archive w/o extension 0.069 0.066 MatchExtension: archive 0.012 0.0115 OpenDocument Text 0.0115 0.011 existent archive with extension 0.017 0.016 existent C with extension 0.011 0.011 existent text file with extension 0.011 0.011 existent C w/o extension 0.016 0.0155 existent patch w/o extension 0.013 0.012 existent archive w/o extension 0.013 0.012 MatchContent: archive 0.019 0.012 OpenDocument Text 0.019 0.012 existent archive with extension 0.053 0.051 existent C with extension 0.056 0.0545 existent text file with extension 0.058 0.056 existent C w/o extension 0.0605 0.059 existent patch w/o extension 0.10 0.099 existent archive w/o extension 0.057 0.054 Change-Id: Idb541656e073a2c4822ace3f4da412f29f2351f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Remove chip.debug compiled binary leftover from debuggingDmitry Shachnev2021-12-061-0/+0
| | | | | | Pick-to: 6.2 Change-Id: I9d1ca06ffb5f9b8fc6e6042c399311dcec059521 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbstractFileEngine: Add permission argument to open()Ievgenii Meshcheriakov2021-12-041-4/+4
| | | | | | | | | The new argument allows atomic creation of files with non-default permissions. Task-number: QTBUG-79750 Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QWaitCondition: also benchmark std::condition_variable{,_any}Marc Mutz2021-11-261-13/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Results on my machine (only forever results): ********* Start testing of tst_QWaitCondition ********* Config: Using QtTest library 6.3.0, Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.2.1 20211115), ubuntu 20.04 PASS : tst_QWaitCondition::oscillate_QWaitCondition_QMutex(forever) RESULT : tst_QWaitCondition::oscillate_QWaitCondition_QMutex():"forever": 637 msecs per iteration (total: 637, iterations: 1) PASS : tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock(forever) RESULT : tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock():"forever": 909 msecs per iteration (total: 909, iterations: 1) PASS : tst_QWaitCondition::oscillate_std_condition_variable_std_mutex(forever) RESULT : tst_QWaitCondition::oscillate_std_condition_variable_std_mutex():"forever": 331 msecs per iteration (total: 331, iterations: 1) PASS : tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex(forever) RESULT : tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex():"forever": 627 msecs per iteration (total: 627, iterations: 1) PASS : tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock(forever) RESULT : tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock():"forever": 913 msecs per iteration (total: 913, iterations: 1) ~331 vs. ~630ms. A pretty significant win (2x). Mårten noticed that on Windows, condition_variable::wait_for(x, 0ms) will not unlock the mutex, which, however, the program requires, so use a 1ns timeout instead. Drive-by fixes: - add override to run() reimplementations - fix type of timeout member variable (was int, should be unsigned long) - fix naming of test functions to distinguish better between QMutex and std::mutex Change-Id: Ib92310f15fbd58258b2043504642be5f0b860f39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QtBase: replace windows.h with qt_windows.hYuhang Zhao2021-11-234-4/+4
| | | | | | | | | | We have some special handling in qt_windows.h, use it instead of the original windows.h Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Rename and restructure the baseline (lancelot) testing codeEirik Aavitsland2021-11-162-5/+7
| | | | | | | | | | | | | | | | | | | | In preparation for addition of new baseline tests, establish a new test category, "baseline". This is similar to the category "benchmarks" in that it contains tests that use the QTest framework, but conceptually are not unit tests, in contrast to those under auto/. Move the existing QPainter baseline test, tst_lancelot, into this new category, and rename it accordingly. Baseline tests use the QBaselineTest extension to QTest. Move that extension too into the tests/baseline directory, allowing the clean out of the baselineserver directory. Pick-to: 6.2 Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QReadWriteLocker: also benchmark recursive modeMarc Mutz2021-11-151-0/+66
| | | | | Change-Id: Ic2e357f4702d05220cf6c96717672dcabacd78d6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-101-1/+3
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove checks for C++ standard versions C++17 and belowIevgenii Meshcheriakov2021-10-011-2/+0
| | | | | | | | | | | Qt requires a compiler that support C++17 thus __cplusplus is always 201703L or higher. This patch removes checks for __cplusplus value that always succeed. Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>