Skip to content

Commit

Permalink
QDBusMessage: de-inline createReply(QVariant)
Browse files Browse the repository at this point in the history
The building of the QList has percolated to the top of the lists of
most expensive template instantiations in Clang -ftime-trace PCH
builds of libQt6Gui.so:

  **** Templates that took longest to instantiate:
    7137 ms: QList<QVariant>::operator<< (260 times, avg 27 ms)
    7115 ms: QList<QVariant>::append (263 times, avg 27 ms)
    7071 ms: QList<QVariant>::emplaceBack<const QVariant &> (256 times, avg 27 ms)
    6651 ms: QtPrivate::QMovableArrayOps<QVariant>::emplace<const QVariant &> (256 times, avg 25 ms)
    [...]
    5649 ms: QArrayDataPointer<QVariant>::detachAndGrow (256 times, avg 22 ms)
    [...]
    4668 ms: QArrayDataPointer<QVariant>::reallocateAndGrow (256 times, avg 18 ms)

Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: Ib766e70e4f741e057f9032bf232160cf6e83f4b9
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
marcmutz committed Jan 19, 2022
1 parent 5590518 commit a5229a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/dbus/qdbusmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,13 @@ QDBusMessage QDBusMessage::createErrorReply(const QString &name, const QString &
}

/*!
\fn QDBusMessage QDBusMessage::createReply(const QVariant &argument) const
Constructs a new DBus message representing a reply, with the
given \a argument.
*/
QDBusMessage QDBusMessage::createReply(const QVariant &argument) const
{
return createReply(QList{argument});
}

/*!
\fn QDBusMessage QDBusMessage::createErrorReply(const QDBusError &error) const
Expand Down
3 changes: 1 addition & 2 deletions src/dbus/qdbusmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class Q_DBUS_EXPORT QDBusMessage
{ return createError(QDBusError::errorString(type), msg); }

QDBusMessage createReply(const QList<QVariant> &arguments = QList<QVariant>()) const;
inline QDBusMessage createReply(const QVariant &argument) const
{ return createReply(QList<QVariant>() << argument); }
QDBusMessage createReply(const QVariant &argument) const;

QDBusMessage createErrorReply(const QString &name, const QString &msg) const;
inline QDBusMessage createErrorReply(const QDBusError &err) const
Expand Down

0 comments on commit a5229a5

Please sign in to comment.