Details
-
Suggestion
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
6.0.0
-
None
Description
Why is the efficiency of QList append method in QT6 much lower than that in QT5?
The average time of appending 1000000 data(ms)
qt5.13.1 | qt6.0.0 | |
debug | 350 | 1300 |
release | 75 | 130 |
#include <QCoreApplication> #include "QList" struct TradeData{ QDateTime beginDate; QString exchangeID; double beginPrice=0; double endPrice=0; int num=0; }; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); qint64 start=QDateTime::currentMSecsSinceEpoch(); TradeData td; td.begindate=QDateTime::currentDateTime(); QList<TradeData>temp; for(int i=0;i<1000000;++i){ temp.push_back(td); } qint64 interval=QDateTime::currentMSecsSinceEpoch()-start; std::cout<<"time:"<<interval<<std::endl; return a.exec(); }