From 5d4f8a947ceb63371c22bd8c42fb0e0c2b5fed73 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 18 Jan 2022 22:32:58 +0100 Subject: [PATCH] QColorTransform: optimize member-swap() We know decltype(d), so we don't need to jump though the ADL-enabling that qSwap() does. Just call QExplicitlySharedDataPointer's member-swap directly. Found through Clang -ftrace-time over PCH'ed libQt6Gui.so build: **** Templates that took longest to instantiate: [...] 4050 ms: qSwap > (87 times, avg 46 ms) which is gone afterwards. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: Ie054848922a50dbf746781491cb28e598c0e12bc Reviewed-by: Fabian Kosmale --- src/gui/painting/qcolortransform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qcolortransform.h b/src/gui/painting/qcolortransform.h index 7ec58c5617..392d74297b 100644 --- a/src/gui/painting/qcolortransform.h +++ b/src/gui/painting/qcolortransform.h @@ -66,7 +66,7 @@ public: } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QColorTransform) - void swap(QColorTransform &other) noexcept { qSwap(d, other.d); } + void swap(QColorTransform &other) noexcept { d.swap(other.d); } Q_GUI_EXPORT QRgb map(QRgb argb) const; Q_GUI_EXPORT QRgba64 map(QRgba64 rgba64) const;