From 36709d7dd59435d34a5192bef14f5e239d3886f2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 4 Jan 2022 09:16:41 +0100 Subject: [PATCH] QPointerEvent: de-inline point(i) This function contributed 1.2s of the total 361s (0.34%) to KDDockWidgets compilation time, according to a trace generated by Sergio Martins: **** Time summary: Compilation (146 times): Parsing (frontend): 343.2 s Codegen & opts (backend): 18.1 s **** Templates that took longest to instantiate: [...] 1228 ms: QList::operator[] (59 times, avg 20 ms) 1213 ms: QList::detach (59 times, avg 20 ms) 1209 ms: QArrayDataPointer::detach (59 times, avg 20 ms) 1202 ms: QArrayDataPointer::reallocateAndGrow (59 times, avg 20 ms) Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: I5f4ff9843f7deff9f390c465df28cba3391e048b Reviewed-by: Lars Knoll --- src/gui/kernel/qevent.cpp | 6 ++++-- src/gui/kernel/qevent.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 6617057b42..81496edacd 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -257,10 +257,12 @@ QInputEvent::~QInputEvent() */ /*! - \fn QEventPoint &QPointerEvent::point(qsizetype i) - Returns a QEventPoint reference for the point at index \a i. */ +QEventPoint &QPointerEvent::point(qsizetype i) +{ + return m_points[i]; +} /*! \fn const QList &QPointerEvent::points() const diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 1c9643fa98..2f8630bad0 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -114,7 +114,7 @@ public: } void setTimestamp(quint64 timestamp) override; qsizetype pointCount() const { return m_points.count(); } - QEventPoint &point(qsizetype i) { return m_points[i]; } + QEventPoint &point(qsizetype i); const QList &points() const { return m_points; } QEventPoint *pointById(int id); bool allPointsGrabbed() const;