Skip to content

Instantly share code, notes, and snippets.

@rowlo
Created January 2, 2014 12:09
Show Gist options
  • Save rowlo/8218364 to your computer and use it in GitHub Desktop.
Save rowlo/8218364 to your computer and use it in GitHub Desktop.
Create a list of a million QTimer objects using reserve(int).
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