summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-01-04 12:58:18 +0100
committerJamey Hicks <jamey.hicks@nokia.com>2012-01-04 14:55:14 +0100
commitd1c0af097cad182f32426324f324a1c971315e59 (patch)
treecf7328fdcedecb3e3577962d346f6a473c90134b
parent0778b49ba94cecb7d8e212b0014d3385527a99c9 (diff)
Update the memory usage numbers
Change-Id: Ibe9637b8e1f2099a5ba14d391e7c227c25aa6238 Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
-rw-r--r--src/qjson_p.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qjson_p.h b/src/qjson_p.h
index 9a49948..545a7dd 100644
--- a/src/qjson_p.h
+++ b/src/qjson_p.h
@@ -76,34 +76,34 @@
string: 4 + 2*length of string
array: size of array
object: size of object
- Array: 16 bytes + 4*length + size of Value data
- Object: 16 bytes + 12*length + size of Key Strings + size of Value data
+ Array: 12 bytes + 4*length + size of Value data
+ Object: 12 bytes + 8*length + size of Key Strings + size of Value data
For an example such as
- { // object: 12 + 5*12 = 72
+ { // object: 12 + 5*8 = 52
"firstName": "John", // key 4+12, value 8 = 24
"lastName" : "Smith", // key 4+8, value 8 = 20
"age" : 25, // key 4+4, value 0 = 8
- "address" : // key 4+8, object below = 160
- { // object: 12 + 4*12
+ "address" : // key 4+8, object below = 154
+ { // object: 12 + 4*8
"streetAddress": "21 2nd Street", // key 4+16, value 16
"city" : "New York", // key 4+4, value 12
"state" : "NY", // key 4+8, value 4
"postalCode" : "10021" // key 4+12, value 8
}, // object total: 148
"phoneNumber": // key: 4+12, value array below = 208
- [ // array: 12 + 2*4 + values below = 192
- { // object 12 + 2*12
+ [ // array: 12 + 2*4 + values below = 176
+ { // object 12 + 2*8
"type" : "home", // key 4+4, value 8
"number": "212 555-1234" // key 4+8, value 16
}, // object total: 84
- { // object 12 + 2*12
+ { // object 12 + 2*8
"type" : "fax", // key 4+4, value 8
"number": "646 555-4567" // key 4+8, value 16
} // object total: 84
] // array total: 248
- } // great total: 472 bytes
+ } // great total: 416 bytes
The uncompressed text file used roughly 500 bytes, so we end up using about the same space
as the text representation.