QJsonObject: use reserve() to reduce memory allocations

Change-Id: I97821ffa0c485815c781dc4f98012b0b490da90a
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Anton Kudryavtsev 2016-04-25 12:20:08 +03:00
parent 1880e8432f
commit 943a658c07
1 changed files with 1 additions and 0 deletions

View File

@ -304,6 +304,7 @@ QVariantHash QJsonObject::toVariantHash() const
{
QVariantHash hash;
if (o) {
hash.reserve(o->length);
for (uint i = 0; i < o->length; ++i) {
QJsonPrivate::Entry *e = o->entryAt(i);
hash.insert(e->key(), QJsonValue(d, o, e->value).toVariant());