src/gui/widgets/qdockarealayout.cpp:1936>>> QDockAreaLayoutItem item(new QDockWidgetItem(widget));
C++ (Qt)QString::fromLatin1( "From: " ) + p_mail_From+QString::fromLatin1( "\nTo: " ) + p_mail_to +QString::fromLatin1( "\nSubject: ") + subject +QString::fromLatin1( "\n\n" ) + body +"\n";
C++ (Qt)QString( "From: %1\nTo: %2\nSubject: %3\n\n%4\n" ).arg(p_mail_From).arg(p_mail_to).arg(subject).arg(body);
C++ (Qt)void test_various::test_plus_vs_format(){ int cnt = 1000000; QString res; QString p_mail_From = "mail@gavgav.ru"; QString p_mail_to = "mail@gavgav.ru"; QString subject = "My cool mega subject"; QString body = QString("Body message ").repeated(10); LOG_DEBUG << "Started QString PLUS operator. Total %1 iterations", cnt; for (int i = 0; i < cnt; i++) { res = "From: " + p_mail_From + "\nTo: " + p_mail_to + "\nSubject: " + subject + "\n\n" + body + "\n"; } LOG_DEBUG << "Finished plus"; LOG_DEBUG << "Started QString .arg() function. Total %1 iterations", cnt; for (int i = 0; i < cnt; i++) { res = QString("From: %1\nTo: %2\nSubject: %3\n\n%4\n").arg(p_mail_From) .arg(p_mail_to).arg(subject).arg(body); } LOG_DEBUG << "Finished arg()";}
2010-Sep-14 13:14:04.882129 D: 72 TH:0 (dbg )1 syslog: Thread #0 with id=0x83358e02010-Sep-14 13:14:04.882129 D: 72 TH:0 (dbg )1 test_various: Started QString PLUS operator. Total 1000000 iterations2010-Sep-14 13:14:06.954295 D:2072166 TH:0 (dbg )1 test_various: Finished plus2010-Sep-14 13:14:06.954465 D: 170 TH:0 (dbg )1 test_various: Started QString .arg() function. Total 1000000 iterations2010-Sep-14 13:14:08.726525 D:1772060 TH:0 (dbg )1 test_various: Finished arg()
C++ (Qt)void test_various::test_plus_vs_format(){ int cnt = 1000000; QString res; QString p_mail_From = "mail@gavgav.ru"; QString p_mail_to = "mail@gavgav.ru"; QString subject = "My cool mega subject"; QString body = QString("Body message ").repeated(10); LOG_DEBUG << "Started QString PLUS operator. Total %1 iterations", cnt; for (int i = 0; i < cnt; i++) { QString s_int = QString::number(i); res = "From: " + p_mail_From + "\nTo: " + p_mail_to + "\n" + s_int + "Subject: " + subject + "\n\n" + body + "\n"; } LOG_DEBUG << "Finished plus"; LOG_DEBUG << "Started QString .arg() function. Total %1 iterations", cnt; for (int i = 0; i < cnt; i++) { QString s_int = QString::number(i); res = QString("From: %1\nTo: %2\n%3Subject: %4\n\n%5\n").arg(p_mail_From) .arg(p_mail_to).arg(s_int).arg(subject).arg(body); } LOG_DEBUG << "Finished arg()";}
2010-Sep-14 14:08:07.448952 D: 71 TH:0 (dbg )1 syslog: Thread #0 with id=0x8718bb82010-Sep-14 14:08:07.448952 D: 71 TH:0 (dbg )1 test_various: Started QString PLUS operator. Total 1000000 iterations2010-Sep-14 14:08:10.661427 D:3212475 TH:0 (dbg )1 test_various: Finished plus2010-Sep-14 14:08:10.661596 D: 169 TH:0 (dbg )1 test_various: Started QString .arg() function. Total 1000000 iterations2010-Sep-14 14:08:13.565228 D:2903632 TH:0 (dbg )1 test_various: Finished arg()
int cnt = 1000000; QString res; QString p_mail_From = "mail@gavgav.ru"; QString p_mail_to = "mail@gavgav.ru"; QString subject = "My cool mega subject"; QString body = QString("Body message ").repeated(10); QTime time; qDebug() << "Started QString .arg() function. Total iterations" << cnt; time.start(); for (int i = 0; i < cnt; i++) { res = QString("From: %1\nTo: %2\nSubject: %3\n\n%4\n%5").arg(p_mail_From) .arg(p_mail_to).arg(subject).arg(body).arg(QString::number(i)); } qDebug() << "Finished arg()" << time.elapsed(); qDebug() << "Started QString PLUS operator. Total iterations" << cnt; time.restart(); for (int i = 0; i < cnt; i++) { res = "From: " + p_mail_From + "\nTo: " + p_mail_to + "\nSubject: " + subject + "\n\n" + body + "\n" + QString::number(i); } qDebug() << "Finished plus" << time.elapsed();