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
parent
1880e8432f
commit
943a658c07
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue