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 <lars.knoll@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Thiago Macieira 2014-02-02 14:03:53 -08:00 committed by The Qt Project
parent d7287f595a
commit 3a3a7f8842
8 changed files with 16 additions and 16 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);