Created
January 2, 2014 12:09
-
-
Save rowlo/8218364 to your computer and use it in GitHub Desktop.
Create a list of a million QTimer objects using reserve(int).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QList<QObject*> buildObjectListWithReserve() | |
{ | |
qint64 size = 10000000; | |
QList<QObject*> objectList; | |
objectList.reserve(size); | |
for (int i = 0; i < size; i++) | |
{ | |
objectList << new QTimer(); | |
} | |
return objectList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment