Significantly speed up insertion into QJsonObject/Array
authorLars Knoll <lars.knoll@nokia.com>
Tue, 20 Mar 2012 19:45:27 +0000 (20:45 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 22 Mar 2012 17:59:45 +0000 (18:59 +0100)
commit349c0de0912884388f2490d4bfd6905424ccf194
treea939e29f8ab31b2a90a0d2d9b67094f0375c901b
parent8dd18751e18ef9509729cbaca6ca5e6810729e2c
Significantly speed up insertion into QJsonObject/Array

The code was only allocating memory for the next insertion
leading to a reallocation of the whole data for every
single insertion.

The code now reserves some space and uses a decent growth
strategy to avoid repeated reallocs.

Change-Id: I48b0feab71ba8ca73e7037f8460080f198b2f009
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
src/corelib/json/qjson.cpp
src/corelib/json/qjson_p.h
tests/benchmarks/corelib/json/tst_bench_qtbinaryjson.cpp