qtbase/src/corelib
Marc Mutz b1b0c2970e QtCore: replace qSwap with std::swap/member-swap where possible
qSwap() is a monster that looks for ADL overloads of swap() and also
detects the noexcept of the wrapped swap() function, so it should only
be used when the argument type is unknown. In the vast majority of
cases, the type is known to be efficiently std::swap()able or to have
a member-swap. Call either of these.

For the common case of pointer types, circumvent the expensive trait
checks on std::swap() by providing a hand-rolled qt_ptr_swap()
template, the advantage being that it can be unconditionally noexcept,
removing all type traits instantiations. Don't document it, otherwise
we'd be unable to pick it to 6.2.

Effects on Clang -ftime-trace of a PCH'ed libQt6Gui.so build:

before:

  **** Template sets that took longest to instantiate:
   [...]
   27766 ms: qSwap<$> (9073 times, avg 3 ms)
   [...]
    2806 ms: std::swap<$> (1229 times, avg 2 ms)

   (30572ms)

after:

  **** Template sets that took longest to instantiate:
   [...]
   5047 ms: qSwap<$> (641 times, avg 7 ms)
   [...]
   3371 ms: std::swap<$> (1376 times, avg 2 ms)
   [qt_ptr_swap<$> does not appear in the top 400, so < 905ms]

   (< 9323ms)

As a drive-by, remove superfluous inline keywords and template
ornaments.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: I88f9b4e3cbece268c4a1238b6d50e5712a1bab5a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-01-20 22:56:12 +01:00
..
animation De-inline ctors/dtors in qabstractanimation_p.h 2022-01-05 08:22:00 +01:00
compat QVersionNumber: port fromString() to QAnyStringView 2022-01-18 01:31:33 +01:00
doc Add documentation for the Android Multi-ABI related variables 2022-01-20 19:01:27 +01:00
global QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
io QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
itemmodels QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
kernel QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
mimetypes QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
platform wasm: add Blob and File type 2021-11-30 09:06:54 +10:00
plugin Doc: Use \inmodule for all classes and headers 2022-01-17 17:23:50 +00:00
serialization QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
text QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
thread QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
time Simplify some #if-ery and use positive tests 2022-01-17 22:29:30 +01:00
tools QtCore: replace qSwap with std::swap/member-swap where possible 2022-01-20 22:56:12 +01:00
CMakeLists.txt CMake: add support for GNU/Hurd 2022-01-19 01:53:14 +01:00
Qt6AndroidMacros.cmake Pass QT_BUILD_STANDALONE_TESTS to Android external project if defined 2022-01-04 12:50:28 +01:00
Qt6CTestMacros.cmake Replace BUILD_OPTIONS_LIST variable by the getter function 2021-12-02 16:34:22 +01:00
Qt6CoreConfigExtras.cmake.in Add CMake deployment support 2021-12-08 19:50:21 +01:00
Qt6CoreConfigureFileTemplate.in
Qt6CoreDeploySupport.cmake CMake: Mark the new deployment API as being in Technical Preview 2021-12-09 19:59:55 +01:00
Qt6CoreMacros.cmake Collect the apk dependencies regardless of target 2022-01-04 12:50:14 +01:00
Qt6WasmMacros.cmake CMake: Make qt6_wasm_add_target_helpers an internal function 2021-08-04 17:01:11 +02:00
QtCore.dynlist Remove old pre-6.0 hooks 2021-10-22 19:12:07 -07:00
configure.cmake CMake: add support for GNU/Hurd 2022-01-19 01:53:14 +01:00
debug_script.py Fix lldbbridge.py loading when using lldb + Python 3 from CLI 2021-09-07 12:53:37 +02:00
qt_cmdline.cmake
qtcore.tracepoints