From 3a3a7f88428a13ddd52d80940fbd086e2355bc23 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 2 Feb 2014 14:03:53 -0800 Subject: [PATCH] Normalize signal & slot signatures in connection Profiling showed that Qt Creator spent 2% of its load time normalizing signals and slots. By pre-normalizing everything, we ensure that there is no runtime cost. Profiling after this commit and the others in this series shows that the cost dropped down to zero. Change-Id: Ifc5a2c2552e245fb9a5f31514e9dd683c5c55327 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/corelib/doc/snippets/signalmapper/filereader.cpp | 4 ++-- src/gui/doc/snippets/clipboard/clipwindow.cpp | 4 ++-- src/gui/doc/snippets/draganddrop/mainwindow.cpp | 8 ++++---- src/gui/doc/snippets/separations/viewer.cpp | 4 ++-- src/platformsupport/linuxaccessibility/application.cpp | 2 +- src/plugins/bearer/connman/qconnmanengine.cpp | 4 ++-- src/widgets/dialogs/qmessagebox.cpp | 4 ++-- src/widgets/kernel/qwindowcontainer.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/corelib/doc/snippets/signalmapper/filereader.cpp b/src/corelib/doc/snippets/signalmapper/filereader.cpp index cb83ea9362a..6770510f5e3 100644 --- a/src/corelib/doc/snippets/signalmapper/filereader.cpp +++ b/src/corelib/doc/snippets/signalmapper/filereader.cpp @@ -74,8 +74,8 @@ FileReader::FileReader(QWidget *parent) //! [2] //slower due to signature normalization at runtime - connect(signalMapper, SIGNAL(mapped(const QString &)), - this, SLOT(readFile(const QString &))); + connect(signalMapper, SIGNAL(mapped(QString)), + this, SLOT(readFile(QString))); //! [2] */ QHBoxLayout *buttonLayout = new QHBoxLayout; diff --git a/src/gui/doc/snippets/clipboard/clipwindow.cpp b/src/gui/doc/snippets/clipboard/clipwindow.cpp index 657ea4e652c..19a685b9d44 100644 --- a/src/gui/doc/snippets/clipboard/clipwindow.cpp +++ b/src/gui/doc/snippets/clipboard/clipwindow.cpp @@ -59,8 +59,8 @@ ClipWindow::ClipWindow(QWidget *parent) //! [0] connect(clipboard, SIGNAL(dataChanged()), this, SLOT(updateClipboard())); //! [0] - connect(mimeTypeCombo, SIGNAL(activated(const QString &)), - this, SLOT(updateData(const QString &))); + connect(mimeTypeCombo, SIGNAL(activated(QString)), + this, SLOT(updateData(QString))); QVBoxLayout *currentLayout = new QVBoxLayout(currentItem); currentLayout->addWidget(mimeTypeLabel); diff --git a/src/gui/doc/snippets/draganddrop/mainwindow.cpp b/src/gui/doc/snippets/draganddrop/mainwindow.cpp index dc1b39422d8..c8d0bf4e091 100644 --- a/src/gui/doc/snippets/draganddrop/mainwindow.cpp +++ b/src/gui/doc/snippets/draganddrop/mainwindow.cpp @@ -54,10 +54,10 @@ MainWindow::MainWindow(QWidget *parent) QLabel *dataLabel = new QLabel(tr("Amount of data (bytes):"), centralWidget); dragWidget = new DragWidget(centralWidget); - connect(dragWidget, SIGNAL(mimeTypes(const QStringList &)), - this, SLOT(setMimeTypes(const QStringList &))); - connect(dragWidget, SIGNAL(dragResult(const QString &)), - this, SLOT(setDragResult(const QString &))); + connect(dragWidget, SIGNAL(mimeTypes(QStringList)), + this, SLOT(setMimeTypes(QStringList))); + connect(dragWidget, SIGNAL(dragResult(QString)), + this, SLOT(setDragResult(QString))); QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget); mainLayout->addWidget(mimeTypeLabel); diff --git a/src/gui/doc/snippets/separations/viewer.cpp b/src/gui/doc/snippets/separations/viewer.cpp index 84ef7b75672..6a0f49ee2f4 100644 --- a/src/gui/doc/snippets/separations/viewer.cpp +++ b/src/gui/doc/snippets/separations/viewer.cpp @@ -119,8 +119,8 @@ void Viewer::createMenus() connect(openAction, SIGNAL(triggered()), this, SLOT(chooseFile())); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveImage())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - connect(brightnessMenu, SIGNAL(triggered(QAction *)), this, - SLOT(setBrightness(QAction *))); + connect(brightnessMenu, SIGNAL(triggered(QAction*)), this, + SLOT(setBrightness(QAction*))); } /* diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp index 5c8f2e5fe24..ae52ab3b570 100644 --- a/src/platformsupport/linuxaccessibility/application.cpp +++ b/src/platformsupport/linuxaccessibility/application.cpp @@ -171,7 +171,7 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event) // FIXME: this is critical, the timeout should probably be pretty low to allow normal processing int timeout = 100; bool sent = dbusConnection.callWithCallback(m, this, SLOT(notifyKeyboardListenerCallback(QDBusMessage)), - SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout); + SLOT(notifyKeyboardListenerError(QDBusError,QDBusMessage)), timeout); if (sent) { //queue the event and send it after callback keyEvents.enqueue(QPair, QKeyEvent*> (QPointer(target), copyKeyEvent(keyEvent))); diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index aee56eb0346..797c30c7c6c 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -98,8 +98,8 @@ void QConnmanEngine::initialize() ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this); connect(ofonoContextManager,SIGNAL(roamingAllowedChanged(bool)),this,SLOT(reEvaluateCellular())); - connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList, QList)), - this, SLOT(updateServices(ConnmanMapList, QList))); + connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList,QList)), + this, SLOT(updateServices(ConnmanMapList,QList))); connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList))); connect(connmanManager,SIGNAL(scanFinished()),this,SLOT(finishedScan())); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 3080d5f1e80..207fe3d527c 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -2697,8 +2697,8 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h) { Q_Q(QMessageBox); - QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole)), - q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton, QPlatformDialogHelper::ButtonRole))); + QObject::connect(h, SIGNAL(clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)), + q, SLOT(_q_clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole))); static_cast(h)->setOptions(options); } diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index a4b3caf78d2..4618e1c91d6 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -197,7 +197,7 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt: d->window = embeddedWindow; d->window->setParent(&d->fakeParent); - connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow *)), this, SLOT(focusWindowChanged(QWindow *))); + connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow*)), this, SLOT(focusWindowChanged(QWindow*))); } QWindow *QWindowContainer::containedWindow() const