Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
Qt Creator 12.0.2, Qt Creator 13.0.0-rc1
-
None
-
-
e57e0b0bf (master)
Description
拉大后
缩小时
//代码占位符 #include <QCoreApplication> #include <QDateTime> #include <QDebug> #include <QVector> #include <QThread>int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QVector<QString> vec(1000000,0); for(int i=0; i<1000000; i++){ vec[i]=QString::number(i); } int find_time=0; int forFindTime=0; for(int count=0; count<10; count++){ // qDebug() << "====Once===="; { QDateTime start = QDateTime::currentDateTime(); QVector<QString>::iterator it = std::find(vec.begin(), vec.end(), "500000"); int t = start.msecsTo(QDateTime::currentDateTime()); qDebug() << "find function find time:" << t; find_time+=t; // QThread::msleep(10); // qDebug() << "find value:"<<(*it); } { QDateTime start = QDateTime::currentDateTime(); for(QString &v : vec){ if(v == "500000"){ break; } } int t = start.msecsTo(QDateTime::currentDateTime()); qDebug() << "for find time:" << t; forFindTime+=t; // QThread::msleep(10); } } qDebug()<<"find_time:"<<find_time/10; qDebug()<<"forFindTime:"<<forFindTime/10; return a.exec(); }