Commit 5e7a95da authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

Added QJsonDocument benchmark

parent b93816f4
......@@ -740,6 +740,24 @@ int main(int argc, char *argv[])
}
STOP("protobuf",QByteArray::fromStdString(buf).toHex());
#endif
START {
ba.resize(0);
QJsonObject p{
{"names" , QJsonArray{person.firstName, person.lastName} },
{"height" , person.height},
{"age" , person.age},
{"comments", person.comments},
{"children", QJsonArray()}}; // would need recursion
QJsonArray phones;
for (auto&& phone : person.phones) {
phones.append(QJsonObject{
{"type" ,quint8(phone._t)},
{"number", phone._n }});
}
p["phones"] = phones;
ba = QJsonDocument(p).toJson(QJsonDocument::Compact);
}
STOP("QJsonDocument",ba)
QBindable bindable;
START {
......
......@@ -38,6 +38,7 @@ QCborStream |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc000000000
Data |00000008004a006f0068006e000000060044006f00653ffc00000000000000000012000000000000007e0075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b003100460020001f0020002b00200055002b00410034002000a400200055002b00420030002000b000200055002b00440038002000d800200055002b00460046002000ff00000000
QDataStream |00000008004a006f0068006e000000060044006f00653ffc00000000000000000012000000000000007e0075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b003100460020001f0020002b00200055002b00410034002000a400200055002b00420030002000b000200055002b00440038002000d800200055002b00460046002000ff00000000
QByteArray |4a006f0044006f000000000000fc3f120000000000000075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b00310046002000000000
QJsonDocument |{"age":18,"children":[],"comments":"unicode is likely U+01 \u0001 + U+1F \u001f + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ","height":1.75,"names":["John","Doe"],"phones":[]}
Bindable |
Bindable>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e65738068636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
Bindable>Json |{"names":["John","Doe"],"height":1.75,"age":18,"phones":[],"comments":"unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ","children":[]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment