Commit 92f27726 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère
Browse files

Separated Person & Phone in benchmark to better see the cost of

reflection+metadata (with Phone)
parent ae96dcfc
......@@ -95,7 +95,7 @@ static QName qBindIgnoredBytes = "Ignored bytes" ;
#include <QtCore/qstring.h>
//! QMetaData is optional data about current data to enable optimized processing (e.g. tag, , style, etc.) and/or transmission (QAbstractItemModel headers, CBOR tags, XML attribute, CSS, numpy.ndarray shapes, etc.)
using QMetaData = std::map<QName,QString>;
using QMetaData = std::map<QName,QString>; // TODO <std::string_view,std::string> for better performance (especially test with Phone's Q_ENUM)
static QName qmDataStreamVersion = "qmDataStreamVersion"; //!< Allows IBind support of QDataStream
......@@ -155,6 +155,8 @@ struct QBindDefault {
// - constructing generic in-memory data structures
// - etc...
#include <functional>
template<class T_> class Rec; //!< a Record data structure defined below
template<class T_> class Seq; //!< a Sequence data structure defined below
......@@ -185,9 +187,11 @@ public:
/**/ Rec<T_> record ( quint32 s) { return record (&s); }
// Shortcuts
// TODO
// template<typename Ts,
// typename T> Seq<T_> sequenceOf(Ts&& ts, std::function<TResult(Val<TResult>)> itemsBind);
template<typename T> Seq<T_> operator<<( T&& t) { return sequence().bind(std::forward<T>(t)); } // stream compatible
/**/ Rec<T_> record (QName n) { return meta({{qmName,n}}).record(); }
private:
T_ outer = T_(); //!< moved context of current traversal up to TResult that will point to the value itself (be it a QIODevice or QCborValue)
};
......
#include "data.h"
#include<QtCore/qdebug.h>
QDebug &operator<<(QDebug &out, const Phone &p) { return out << "Phone(" << p._t << ", " << p._n <<")" ; }
QDebug &operator<<(QDebug &out, const Phone &p) { return out.nospace() << "Phone(" << p._t << ", " << p._n <<")" ; }
#include<QtCore/qdatastream.h>
QDataStream &operator<<(QDataStream &out, const Phone &p) { return out << quint8(p._t) << p._n ; }
......
......@@ -24,8 +24,7 @@ Q_DECLARE_METATYPE(Phone)
// For comparison purposes:
#include<QtCore/qdebug.h>
QDebug &operator<<(QDebug &out, const Phone &p);
QDebug &operator<<(QDebug &out, const Phone &p);
#include<QtCore/qdatastream.h>
QDataStream &operator<<(QDataStream &out, const Phone &p);
QDataStream &operator>>(QDataStream &out, Phone &p);
......@@ -96,6 +96,19 @@ struct Person
}
};
// For comparison purposes:
#include<QtCore/qdebug.h>
QDebug &operator<<(QDebug &out, const Person &p)
{
return out.nospace() << "Person(" // items count and names are implicit
<< p.firstName << ", " << p.lastName << ", " // sequence is implicit
<< p.height << ", "
<< p.age << ", "
<< p.phones << ", "
<< p.comments << ", "
<< p.children << ")";
}
#include<QtCore/qdatastream.h>
QDataStream &operator<<(QDataStream &out, const Person &p)
{
......@@ -257,7 +270,7 @@ int main(int argc, char *argv[])
2./3, 1./3, 2./3, 1.,
1./3, 2./3, 1./3, 1.,
0. , 0. , 0. , 1.};
Person person{"John","Doe",1.75,18,{{Phone::Home,"+44 1234567"},{Phone::Office,"+44 2345678"}},"unicode is likely U+01 \x01 + U+1F \x1F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ",QList<Person>()};
Person person{"John","Doe",1.75,18,{},"unicode is likely U+01 \x01 + U+1F \x1F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ",QList<Person>()};
const double PI=3.141592653589793;
// Temporary buffers
......@@ -345,13 +358,12 @@ int main(int argc, char *argv[])
s.append(ascii);
s.append(false);
s.startMap();
s.append("RGB");
s.startArray();
s.append("RGB");s.startArray();
s.append(quint8(color.red ()));
s.append(quint8(color.green()));
s.append(quint8(color.blue ()));
s.endArray();
s.append("base"); s.append(quint8(255));
s.append("base");s.append(quint8(255));
s.endMap();
s.endArray();
}
......@@ -451,10 +463,10 @@ int main(int argc, char *argv[])
START {
b.seek(0); b.buffer().resize(0);
QCborStreamWriter s(&b);
quint64 size = 16;
constexpr quint64 size = 16;
s.startArray(size);
for (quint8 i=0; i < size; i++) {
s.append(transform[i]);
s.append(transform[i]);
};
s.endArray();
}
......@@ -506,15 +518,8 @@ int main(int argc, char *argv[])
{
START {
s.resize(0);
QDebug(&s)
<< person.firstName
<< person. lastName
<< person. height
<< person. age
<< person. phones
<< person. comments
// TODO operator<<(QDebug&) to handle children
;
QDebug dbg(&s);
dbg << person;
}
STOP("QDebug",s);
START {
......@@ -532,7 +537,7 @@ int main(int argc, char *argv[])
QXmlStreamWriter w(&ba);
QXmlWriter d(&w);
d.bind(person);
w.writeEndDocument(); // FIXME
w.writeEndDocument(); // FIXME It should not be necessary
}
STOP("Xml",QString::fromUtf8(ba));
START {
......@@ -545,7 +550,6 @@ int main(int argc, char *argv[])
QCborWriter(&ba).bind(person);
}
STOP("Cbor",QString::fromUtf8(ba.toHex()));
START {
b.seek(0); b.buffer().resize(0);
QCborStreamWriter s(&b);
......@@ -554,20 +558,20 @@ int main(int argc, char *argv[])
s.append(person.firstName);
s.append(person. lastName);
s.endArray();
s.append("height" );s.append(person.height );
s.append("age" );s.append(person.age ); // or .any() to ignore
s.append("phones" );
int size = person.phones.size();
s.startArray(quint64(size));
s.append("height");s.append(person.height );
s.append("age" );s.append(person.age ); // or .any() to ignore
int size = person.phones.size();
s.append("phones");s.startArray(quint64(size));
for (int i=0; i < size; i++) {
s.startMap();
s.append("type");s.append(person.phones[i]._t);
s.append("type" );s.append(person.phones[i]._t);
s.append("number");s.append(person.phones[i]._n);
s.endMap();
};
s.endArray();
s.append("comments");s.append(person.comments.toUtf8().constData());
s.append("children");s.startArray(0);
s.append("comments");s.append(person.comments);
s.append("children");s.startArray(quint64(person.children.size()));
// Would need recursion
s.endArray();
s.endMap();
}
......@@ -587,15 +591,21 @@ int main(int argc, char *argv[])
QByteArray str; str.reserve(100); int s;
START {
str.resize(0);
str.append("John"); // encoding must be specified externally
str.append("Doe");
str.append(reinterpret_cast<const char*>(&person.height),sizeof(person.height)); // endianness must be specified externally
str.append(reinterpret_cast<const char*>(person.firstName.constData()),person.firstName.size());// encoding must be specified externally
str.append(reinterpret_cast<const char*>(person.lastName .constData()),person.lastName .size());
str.append(reinterpret_cast<const char*>(&person.height),sizeof(person.height)); // endianness must be specified externally
str.append(reinterpret_cast<const char*>(&person.age ),sizeof(person.age ));
s=2; /*phones*/ str.append(reinterpret_cast<const char*>(&s),sizeof(s));
str.append("+44 1234567");
str.append("+44 2345678");
str.append("unicode is likely U+01 \x01 + U+1F \x1F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ"); // byte order must be specified externally
s=0; /*children*/ str.append(reinterpret_cast<const char*>(&s),sizeof(s));
s=person.phones.size();
str.append(reinterpret_cast<const char*>(&s),sizeof(s));
for (int i=0; i<s; ++i) {
str.append(reinterpret_cast<const char*>(&person.phones[i]._t),sizeof(person.phones[i]._t));str.append(person.phones[i]._n);
}
str.append(reinterpret_cast<const char*>(person.comments.constData()),person.comments.size()); // byte order must be specified externally
s=person.children.size();
str.append(reinterpret_cast<const char*>(&s),sizeof(s));
for (int i=0; i<s; ++i) {
Q_ASSERT(false); // Would need recursion
}
}
STOP("QByteArray",str.toHex());
#ifdef PROTOBUF
......@@ -605,8 +615,6 @@ int main(int argc, char *argv[])
pb.set_lastname("Doe");
pb.set_height(1.75);
pb.set_age(18);
pb.add_phones("+44 1234567");
pb.add_phones("+44 2345678");
pb.set_comments("unicode is likely U+01 \x01 + U+1F \x1F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ");
START {
buf.resize(0);
......@@ -632,11 +640,94 @@ int main(int argc, char *argv[])
STOP("Writable>Json",QString::fromUtf8(b.buffer()));
}
GROUP_STOP
Phone phone {Phone::Home,"+44 1234567"};
GROUP("Phone>")//=========================================================
{
START {
s.resize(0);
QDebug dbg(&s);
dbg << phone;
}
STOP("QDebug",s);
START {
ba.resize(0);
TextWriter(&ba).bind(phone);
}
STOP("Text",QString::fromUtf8(b.buffer()));
START {
b.seek(0); b.buffer().resize(0);
QJsonWriter(&b).bind(phone);
}
STOP("Json",b.buffer())
START {
ba.resize(0);
QXmlStreamWriter w(&ba);
QXmlWriter d(&w);
d.bind(phone);
}
STOP("Xml",QString::fromUtf8(ba));
START {
v.clear();
QVariantBuilder(&v).bind(phone);
}
STOP("Variant",QString(Text(v)));
START {
ba.resize(0);
QCborWriter(&ba).bind(phone);
}
STOP("Cbor",QString::fromUtf8(ba.toHex()));
START {
b.seek(0); b.buffer().resize(0);
QCborStreamWriter s(&b);
s.startMap();
s.append("type" );s.append(phone._t);
s.append("number");s.append(phone._n);
s.endMap();
}
STOP("QCborStream",QString::fromUtf8(b.buffer().toHex()));
START {
b.seek(0); b.buffer().resize(0);
QDataStream d(&b);
QDataWriter(&d).value().bind(phone);
}
STOP("Data",QString::fromUtf8(b.buffer().toHex()));
START {
b.seek(0); b.buffer().resize(0);
QDataStream d(&b);
d << phone;
}
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
QByteArray str; str.reserve(100); int s;
START {
str.resize(0);
str.append(reinterpret_cast<const char*>(&phone._t),sizeof(phone._t));str.append(phone._n);
}
STOP("QByteArray",str.toHex());
QBindable<> writable;
START {
writable = phone;
}
STOP("Writable","");
START {
ba.resize(0);
QCborWriter(&ba).bind(writable);
}
STOP("Writable>Cbor",QString::fromUtf8(ba.toHex()));
START {
b.seek(0); b.buffer().resize(0);
QJsonWriter(&b).bind(writable);
}
STOP("Writable>Json",QString::fromUtf8(b.buffer()));
}
GROUP_STOP
GROUP("Person<>Json")//====================================================
{
QBuffer json; json.open(QIODevice::ReadOnly);
json.buffer() = "_{ \"names\": [ _\"John\" _, \"Doe\"] , \"age\"_:_null, \"height\":_1.75, \"phones\": [ {\"type\":2,\"number\":\"+44 1234567\"} , {\"type\":3,\"number\":\"+44 2345678\"} ], \"\":\"superfluous item\" _} ";
// 1 15 23 4042 58 172
json.buffer() = "_{ \"names\": [ _\"John\" _, \"Doe\"] , \"age\"_:_null, \"height\":_1.75, \"phones\": [], \"\":\"superfluous item\" _} ";
// 1 15 23 4042 58 101
Person p;
QBuffer roundtrip; roundtrip.open(QIODevice::ReadWrite);
QJsonValue jv;
......@@ -677,27 +768,28 @@ int main(int argc, char *argv[])
STOP("JsonValue>P",QString::fromUtf8(Text(p)+Text(visitorErrors)))
//---------------------------------------------------------------------
START {
roundtrip.seek(0); ba.resize(0);
QJsonReader r(&roundtrip);
r.bind(QCborWriter(&ba).value());
roundtrip.seek(0); jv = QJsonValue();
QJsonReader r(&roundtrip); // FIXME
r.bind(jv);
readerErrors = r.errors;
}
STOP("Json>Cbor",ba.toHex())
STOP("Json>JsonValue",QString::fromUtf8(QJsonDocument(jv.toObject()).toJson(QJsonDocument::Compact)+Text(readerErrors)));
// TODO JsonValue>Json
START {
roundtrip.seek(0); jv = QJsonValue();
QJsonReader r(&roundtrip);
r.bind(jv);
roundtrip.seek(0); ba.resize(0);
QJsonReader r(&roundtrip); // FIXME
r.bind(QCborWriter(&ba).value());
readerErrors = r.errors;
}
STOP("Json>JsonValue",QString::fromUtf8(QJsonDocument(jv.toObject()).toJson()+Text(readerErrors)));
STOP("Json>Cbor",ba.toHex())
}
GROUP_STOP
GROUP("Person<>Cbor")//====================================================
{
QBuffer cbor; cbor.open(QIODevice::ReadOnly);
cbor.buffer() = QByteArray::fromHex(
"A5656E616D657382644A6F686E63446F6563616765F666686569676874F93F006670686F6E657382A2647479706502666E756D6265726B2B34342031323334353637A2647479706503666E756D6265726B2B3434203233343536373860707375706572666C756F7573206974656D");
// { "names": [ "John", "Doe"], "age":null,"height": 1.75, "phones": [ { "type": 2,"number": "+44 1234567"}, { "type": 3,"number": "+44 2345678"}], "":"superfluous item"}
"A5656E616D657382644A6F686E63446F6563616765F666686569676874F93F006670686F6E65738060707375706572666C756F7573206974656D");
// { "names": [ "John", "Doe"], "age":null,"height": 1.75, "phones": [],"":"superfluous item"}
Person p;
QBuffer roundtrip; roundtrip.open(QIODevice::ReadWrite);
QCborValue cv;
......@@ -838,7 +930,7 @@ int main(int argc, char *argv[])
ba.resize(0);
QCborWriter(&ba).bind(cv);
}
STOP("Cbor<CborValue",ba.toHex());
STOP("CborValue>Cbor",ba.toHex());
//---------------------------------------------------------------------
START {
roundtrip.seek(0); b.seek(0); b.buffer().resize(0);
......@@ -854,7 +946,7 @@ int main(int argc, char *argv[])
// Adapt dataset to different views
person.firstName="";
person.comments="";
person.phones.takeLast();
person.phones.append(phone);
QVector<Person> persons; persons << person << person;
persons[0].age=42;
persons[0].children.append(person);
......
group | QDebug| Text| Json| Xml| Variant| Cbor| QCborStream| Data| QDataStream| QByteArray| Writables|Writables>Cbor|Writables>Json|total(usecs)|variation(%)
builtin> | 7.9| 2.2| 6.4| 27.0| 9.8| 0.7| 1.6| 0.9| 0.5| 0.1| 0.1| 0.7| 6.5| 64.4| 34.4
builtin> | 7.8| 2.2| 8.5| 29.7| 9.8| 0.7| 1.4| 0.9| 0.5| 0.1| 0.1| 0.7| 6.4| 68.9| 6.9
builtin> | 7.8| 2.2| 6.2| 26.1| 9.9| 0.7| 1.4| 0.9| 0.5| 0.1| 0.1| 0.7| 6.4| 63.0| 8.5
builtin> | 7.8| 2.2| 6.2| 26.4| 9.7| 1.1| 1.4| 0.9| 0.5| 0.1| 0.1| 0.7| 6.4| 63.4| 0.6
builtin> | 7.7| 2.2| 6.2| 25.7| 9.6| 0.7| 1.4| 1.0| 0.5| 0.1| 0.1| 0.7| 6.6| 62.5| 1.4
builtin> | 20.4| 3.9| 11.3| 47.0| 17.1| 1.2| 2.2| 1.5| 0.8| 0.2| 0.1| 1.1| 10.4| 117.2| 48.7
builtin> | 12.4| 3.6| 11.8| 42.1| 15.4| 1.0| 2.3| 1.4| 0.8| 0.2| 0.1| 1.1| 10.3| 102.7| 12.3
builtin> | 12.6| 3.5| 11.6| 47.2| 14.2| 1.0| 2.1| 1.3| 0.7| 0.1| 0.1| 1.0| 10.0| 105.5| 2.7
builtin> | 11.6| 2.9| 8.3| 34.5| 13.0| 0.8| 1.8| 1.2| 1.1| 0.3| 0.2| 2.0| 14.0| 91.7| 13.1
builtin> | 10.5| 2.9| 8.3| 34.7| 13.0| 0.8| 1.9| 1.2| 0.7| 0.1| 0.1| 1.0| 9.0| 84.2| 8.1
builtin> | 10.2| 2.8| 8.1| 36.7| 12.5| 0.8| 1.7| 1.1| 0.6| 0.1| 0.1| 0.9| 7.9| 83.4| 0.9
builtin> | 10.3| 2.7| 7.6| 31.8| 11.9| 0.8| 1.8| 1.1| 0.6| 0.1| 0.1| 0.9| 7.9| 77.5| 7.1
group | QDebug| Text| Json| Xml| Variant| Cbor| QCborStream| Data| QDataStream| QByteArray| Writable| Writable>Cbor| Writable>Json|total(usecs)|variation(%)
doubles> | 19.3| 14.9| 17.9| 56.2| 25.3| 0.7| 1.1| 1.4| 0.9| 0.3| 0.0| 0.8| 17.9| 156.6| 0.7
doubles> | 18.2| 15.1| 17.9| 54.3| 25.9| 0.7| 1.2| 1.0| 0.9| 0.3| 0.0| 0.6| 17.9| 154.0| 1.7
doubles> | 21.8| 18.7| 22.2| 75.4| 33.6| 0.9| 1.5| 1.3| 1.1| 1.2| 0.0| 0.9| 25.0| 203.5| 0.4
doubles> | 25.1| 18.4| 23.5| 85.0| 34.2| 0.9| 1.5| 1.3| 1.1| 0.5| 0.0| 0.9| 24.1| 216.5| 6.4
group | QDebug| Text| Json| Xml| Variant| Cbor| QCborStream| Data| QDataStream| QByteArray| Writable| Writable>Cbor| Writable>Json|total(usecs)|variation(%)
Person> | 8.1| 14.5| 23.2| 53.6| 26.8| 10.3| 4.6| 1.1| 0.9| 0.2| 0.0| 10.1| 23.9| 177.3| 3.0
Person> | 8.2| 15.8| 23.6| 52.4| 27.5| 10.5| 4.8| 1.1| 0.9| 0.2| 0.0| 10.9| 23.9| 179.7| 1.4
Person> | 8.1| 14.7| 23.8| 52.7| 29.7| 10.0| 4.6| 1.1| 0.9| 0.2| 0.0| 10.1| 23.1| 179.0| 0.4
Person> | 8.0| 14.8| 22.7| 54.8| 26.7| 10.0| 4.6| 1.1| 0.9| 0.2| 0.0| 11.9| 22.9| 178.6| 0.2
group | Json>P| P>Json| Json>P| P>JsonValue| JsonValue>P| Json>Cbor|Json>JsonValue|total(usecs)|variation(%)
Person<>Json| 32.0| 16.9| 29.6| 35.2| 9.5| 31.8| 38.8| 193.8| 2.1
Person<>Json| 33.9| 17.0| 29.0| 30.9| 9.5| 39.1| 38.3| 197.6| 1.9
Person<>Json| 32.3| 17.0| 29.8| 35.1| 9.5| 31.8| 42.1| 197.7| 0.1
Person<>Json| 31.9| 19.4| 29.0| 33.7| 10.0| 31.7| 42.9| 198.6| 0.5
group | Cbor>P| P>Cbor| Cbor>P| QCborStream>P| P>CborValue| CborValue>P|Cbor>CborValue|Cbor<CborValue| Cbor>Json|total(usecs)|variation(%)
Person<>Cbor| 27.8| 14.1| 35.8| 9.6| 28.1| 9.8| 42.8| 14.3| 15.9| 198.1| 6.9
Person<>Cbor| 26.8| 10.3| 27.2| 9.6| 31.2| 9.8| 39.8| 14.4| 14.8| 183.8| 7.2
Person<>Cbor| 26.8| 12.5| 27.2| 9.7| 28.5| 9.6| 38.4| 20.8| 15.0| 188.5| 2.6
Person<>Cbor| 30.5| 10.3| 26.6| 9.6| 28.2| 9.8| 40.5| 18.2| 14.9| 188.5| 0.0
Person<>Cbor| 26.3| 10.3| 26.8| 9.8| 32.5| 10.4| 38.4| 14.4| 14.8| 183.6| 2.6
Person> | 8.4| 6.7| 16.1| 33.0| 13.9| 3.7| 4.9| 1.1| 0.7| 0.2| 0.0| 3.7| 15.6| 108.0| 1.6
Person> | 8.3| 6.2| 14.3| 30.5| 14.0| 3.1| 3.5| 1.0| 0.7| 0.2| 0.0| 3.1| 15.3| 100.2| 7.2
Person> | 8.2| 8.5| 14.4| 30.5| 15.3| 3.1| 3.4| 1.1| 0.7| 0.2| 0.0| 3.1| 14.9| 103.6| 3.4
Person> | 7.8| 6.2| 14.1| 34.0| 14.0| 3.2| 3.5| 1.0| 0.7| 0.2| 0.0| 3.2| 14.8| 102.6| 0.9
Person> | 7.7| 6.2| 14.3| 32.0| 15.5| 3.8| 4.7| 1.0| 0.7| 0.2| 0.0| 3.6| 15.7| 105.3| 2.6
group | QDebug| Text| Json| Xml| Variant| Cbor| QCborStream| Data| QDataStream| QByteArray| Writable| Writable>Cbor| Writable>Json|total(usecs)|variation(%)
Phone> | 2.6| 5.7| 6.9| 14.8| 7.4| 6.9| 1.3| 0.5| 0.2| 0.5| 0.0| 5.1| 8.9| 60.9| 4.9
Phone> | 2.5| 5.8| 6.9| 14.9| 7.4| 5.0| 1.5| 0.6| 0.3| 0.5| 0.0| 5.1| 7.4| 57.8| 5.0
Phone> | 2.7| 6.3| 7.9| 15.5| 8.4| 5.2| 1.4| 0.6| 0.3| 0.5| 0.0| 10.0| 9.8| 68.4| 18.3
Phone> | 2.9| 6.2| 16.9| 16.3| 14.6| 5.2| 1.5| 0.6| 0.3| 0.7| 0.0| 5.0| 7.8| 78.1| 14.1
Phone> | 2.7| 6.2| 7.5| 16.5| 12.8| 6.3| 1.7| 0.6| 0.3| 0.5| 0.0| 5.2| 8.6| 68.9| 11.7
Phone> | 2.7| 13.6| 8.8| 16.3| 8.1| 5.0| 2.0| 0.6| 0.3| 0.5| 0.0| 5.4| 7.2| 70.5| 2.3
Phone> | 2.9| 7.1| 8.0| 27.6| 14.6| 7.1| 1.6| 0.6| 0.3| 0.6| 0.0| 5.5| 8.0| 83.8| 18.8
Phone> | 3.0| 7.2| 10.1| 20.7| 9.6| 11.8| 2.0| 0.6| 0.3| 0.6| 0.0| 8.0| 7.9| 81.9| 2.2
Phone> | 3.5| 11.1| 8.0| 17.7| 9.0| 5.5| 1.6| 0.6| 0.3| 0.6| 0.0| 5.6| 8.4| 71.8| 12.3
Phone> | 5.3| 6.9| 8.2| 21.3| 13.0| 5.7| 2.4| 0.6| 0.3| 1.0| 0.1| 11.7| 11.8| 88.2| 22.7
Phone> | 3.3| 12.4| 11.2| 18.1| 8.9| 5.7| 1.6| 0.6| 0.4| 0.6| 0.0| 5.4| 8.3| 76.4| 13.3
Phone> | 3.1| 7.0| 8.1| 17.7| 10.7| 5.5| 1.6| 0.6| 0.3| 0.6| 0.0| 5.7| 8.8| 69.8| 8.7
Phone> | 3.0| 6.9| 8.2| 18.2| 8.7| 9.4| 1.7| 0.6| 0.3| 0.5| 0.0| 5.1| 7.5| 69.9| 0.2
Phone> | 2.7| 6.3| 7.6| 17.6| 9.8| 5.0| 1.4| 0.6| 0.3| 0.5| 0.0| 5.1| 7.5| 64.3| 8.1
group | Json>P| P>Json| Json>P| P>JsonValue| JsonValue>P|Json>JsonValue| Json>Cbor|total(usecs)|variation(%)
Person<>Json| 20.6| 8.9| 15.2| 14.6| 4.9| 27.3| 26.3| 117.9| 1.6
Person<>Json| 18.3| 7.4| 13.7| 13.4| 4.5| 25.6| 23.6| 106.5| 9.7
Person<>Json| 17.1| 7.4| 16.5| 15.1| 5.2| 27.3| 25.1| 113.7| 6.8
Person<>Json| 18.3| 7.3| 15.5| 15.1| 5.5| 27.7| 24.5| 113.9| 0.2
Person<>Json| 17.3| 7.5| 14.1| 13.7| 4.5| 27.5| 25.7| 110.3| 3.2
group | Cbor>P| P>Cbor| Cbor>P| QCborStream>P| P>CborValue| CborValue>P|Cbor>CborValue|CborValue>Cbor| Cbor>Json|total(usecs)|variation(%)
Person<>Cbor| 19.4| 3.7| 18.6| 7.1| 11.7| 5.5| 27.8| 15.2| 18.1| 127.3| 10.4
Person<>Cbor| 17.9| 3.2| 18.6| 6.9| 12.2| 5.5| 25.8| 14.9| 18.0| 123.0| 3.3
Person<>Cbor| 18.1| 3.4| 18.1| 7.0| 11.7| 5.6| 24.7| 17.4| 19.2| 125.3| 1.8
Person<>Cbor| 18.4| 3.5| 19.6| 7.6| 13.3| 6.0| 26.8| 19.3| 21.1| 135.7| 8.3
Person<>Cbor| 17.3| 3.5| 18.5| 7.1| 11.8| 5.7| 25.6| 14.8| 18.6| 122.9| 9.5
Person<>Cbor| 18.9| 3.4| 18.4| 8.0| 12.0| 5.4| 24.7| 14.4| 21.1| 126.2| 2.7
Person<>Cbor| 17.7| 3.2| 18.2| 7.0| 11.7| 5.5| 27.1| 15.1| 18.0| 123.7| 2.1
Person<>Cbor| 24.0| 3.7| 18.2| 7.0| 12.2| 5.6| 26.1| 14.6| 17.7| 129.1| 4.4
Person<>Cbor| 21.4| 3.6| 18.2| 7.1| 11.8| 5.5| 25.1| 14.7| 17.7| 125.0| 3.2
Person<>Cbor| 17.0| 3.3| 21.9| 7.0| 12.2| 5.5| 24.8| 14.5| 17.6| 123.7| 1.1
Person<>Cbor| 16.9| 3.2| 24.5| 8.0| 14.0| 6.0| 27.2| 16.1| 19.1| 135.1| 9.2
Person<>Cbor| 18.3| 3.5| 20.4| 7.5| 13.1| 6.0| 26.8| 22.3| 19.1| 137.0| 1.4
Person<>Cbor| 19.2| 3.5| 23.0| 7.3| 11.8| 5.7| 25.0| 14.5| 17.8| 127.8| 6.7
Person<>Cbor| 17.1| 3.3| 18.7| 8.7| 13.0| 5.6| 24.7| 14.4| 20.3| 125.9| 1.5
Person<>Cbor| 16.9| 3.2| 18.2| 7.3| 16.9| 6.0| 27.3| 15.5| 18.9| 130.2| 3.4
Person<>Cbor| 18.3| 3.5| 20.0| 8.2| 14.2| 5.9| 26.8| 15.5| 19.2| 131.5| 1.0
Person<>Cbor| 18.2| 3.6| 19.6| 7.5| 14.9| 5.5| 26.4| 14.6| 17.5| 127.9| 2.8
Person<>Cbor| 17.0| 3.2| 18.7| 7.0| 11.6| 5.6| 28.0| 15.6| 19.5| 126.3| 1.2
Person<>Cbor| 18.7| 3.5| 19.8| 7.6| 12.6| 6.0| 38.6| 14.1| 17.4| 138.2| 9.5
Person<>Cbor| 16.9| 3.2| 19.1| 7.0| 11.8| 5.5| 27.8| 16.1| 19.1| 126.4| 8.5
Person<>Cbor| 18.3| 3.7| 19.7| 7.6| 12.7| 6.2| 30.3| 14.4| 17.5| 130.4| 3.2
Person<>Cbor| 17.0| 3.6| 18.1| 7.0| 11.5| 5.2| 21.3| 13.1| 14.6| 111.5| 14.5
Person<>Cbor| 14.7| 2.8| 15.7| 6.1| 9.7| 4.8| 20.1| 11.8| 14.8| 100.3| 10.1
Person<>Cbor| 18.2| 2.9| 16.2| 5.9| 9.7| 4.4| 21.1| 12.6| 14.5| 105.5| 5.2
Person<>Cbor| 14.0| 2.8| 15.4| 6.4| 10.2| 4.9| 21.9| 12.6| 15.5| 103.8| 1.6
Person<>Cbor| 14.8| 2.6| 16.0| 5.8| 9.6| 4.6| 21.9| 12.8| 15.5| 103.7| 0.1
Person<>Cbor| 15.1| 2.8| 16.0| 6.2| 10.3| 4.9| 21.9| 12.8| 16.4| 106.4| 2.6
......@@ -27,37 +27,49 @@ Writable |
Writable>Cbor |90fb3fd5555555555555fb3fe5555555555555fb3fd5555555555555fb3ff0000000000000fb3fe5555555555555fb3fd5555555555555fb3fe5555555555555fb3ff0000000000000fb3fd5555555555555fb3fe5555555555555fb3fd5555555555555fb3ff0000000000000fb0000000000000000fb0000000000000000fb0000000000000000fb3ff0000000000000
Writable>Json |[0.33333333333333331,0.66666666666666663,0.33333333333333331,1,0.66666666666666663,0.33333333333333331,0.66666666666666663,1,0.33333333333333331,0.66666666666666663,0.33333333333333331,1,0,0,0,1]
group |Person>
QDebug |"John" "Doe" 1.75 18 QVector(Phone(Phone::Home, "+44 1234567"), Phone(Phone::Office, "+44 2345678")) "unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 U+B0 U+D8 U+FF "
Text |(Person)[ names:[ John Doe] height:1.75 age:18 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments:unicode is likely U+01  + U+1F  + U+A4 U+B0 U+D8 U+FF children:[]]
Json |{"names":["John","Doe"],"height":1.75,"age":18,"phones":[{"type":2,"number":"+44 1234567"},{"type":3,"number":"+44 2345678"}],"comments":"unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 U+B0 U+D8 U+FF ","children":[]}
Xml |<Person><names><string>John</string><string>Doe</string></names><height>1.75</height><age>18</age><phones><Phone><Home>2</Home><number>+44 1234567</number></Phone><Phone><Office>3</Office><number>+44 2345678</number></Phone></phones><comments>unicode is likely U+01 + U+1F + U+A4 U+B0 U+D8 U+FF </comments><children/></Person>
QDebug |Person("John", "Doe", 1.75, 18, QVector(), "unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 U+B0 U+D8 U+FF ", ())
Text |(Person)[ names:[ John Doe] height:1.75 age:18 phones:[] comments:unicode is likely U+01  + U+1F  + U+A4 U+B0 U+D8 U+FF children:[]]
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":[]}
Xml |<Person><names><string>John</string><string>Doe</string></names><height>1.75</height><age>18</age><phones/><comments>unicode is likely U+01 + U+1F + U+A4 U+B0 U+D8 U+FF </comments><children/></Person>
Variant |[ age:18 children:[] comments:unicode is likely U+01  + U+1F  + U+A4 U+B0 U+D8 U+FF height:1.75 names:[ John Doe] phones:[ [ number:+44 1234567 type:2] [ number:+44 2345678 type:3]]]
Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e657382bf647479706502666e756d6265726b2b34342031323334353637ffbf647479706503666e756d6265726b2b34342032333435363738ff68636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
QCborStream |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e657382bf647479706502666e756d6265726b2b34342031323334353637ffbf647479706503666e756d6265726b2b34342032333435363738ff68636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
Data |00000008004a006f0068006e000000060044006f00653ffc00000000000000000012000000020200000016002b00340034002000310032003300340035003600370300000016002b00340034002000320033003400350036003700380000007e0075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b003100460020001f0020002b00200055002b00410034002000a400200055002b00420030002000b000200055002b00440038002000d800200055002b00460046002000ff00000000
QDataStream |00000008004a006f0068006e000000060044006f00653ffc00000000000000000012000000020200000016002b00340034002000310032003300340035003600370300000016002b00340034002000320033003400350036003700380000007e0075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b003100460020001f0020002b00200055002b00410034002000a400200055002b00420030002000b000200055002b00440038002000d800200055002b00460046002000ff00000000
QByteArray |4a6f686e446f65000000000000fc3f12000000020000002b343420313233343536372b34342032333435363738756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf00000000
Variant |[ age:18 children:[] comments:unicode is likely U+01  + U+1F  + U+A4 U+B0 U+D8 U+FF height:1.75 names:[ John Doe] phones:[]]
Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e65738068636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
QCborStream |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e65738068636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
Data |00000008004a006f0068006e000000060044006f00653ffc00000000000000000012000000000000007e0075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b003100460020001f0020002b00200055002b00410034002000a400200055002b00420030002000b000200055002b00440038002000d800200055002b00460046002000ff00000000
QDataStream |00000008004a006f0068006e000000060044006f00653ffc00000000000000000012000000000000007e0075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b003100460020001f0020002b00200055002b00410034002000a400200055002b00420030002000b000200055002b00440038002000d800200055002b00460046002000ff00000000
QByteArray |4a006f0044006f000000000000fc3f120000000000000075006e00690063006f006400650020006900730020006c0069006b0065006c007900200055002b00300031002000010020002b00200055002b00310046002000000000
Writable |
Writable>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e657382bf647479706502666e756d6265726b2b34342031323334353637ffbf647479706503666e756d6265726b2b34342032333435363738ff68636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
Writable>Json |{"names":["John","Doe"],"height":1.75,"age":18,"phones":[{"type":2,"number":"+44 1234567"},{"type":3,"number":"+44 2345678"}],"comments":"unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 U+B0 U+D8 U+FF ","children":[]}
Writable>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e65738068636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
Writable>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":[]}
group |Phone>
QDebug |Phone(Phone::Home, "+44 1234567")
Text |(Phone)[ type:(Home)2 number:+44 1234567]
Json |{"type":2,"number":"+44 1234567"}
Xml |<Phone><Home>2</Home><number>+44 1234567</number></Phone>
Variant |[ number:+44 1234567 type:2]
Cbor |bf647479706502666e756d6265726b2b34342031323334353637ff
QCborStream |bf647479706502666e756d6265726b2b34342031323334353637ff
Data |0200000016002b0034003400200031003200330034003500360037
QDataStream |0200000016002b0034003400200031003200330034003500360037
QByteArray |022b34342031323334353637
Writable |
Writable>Cbor |bf647479706502666e756d6265726b2b34342031323334353637ff
Writable>Json |{"type":2,"number":"+44 1234567"}
group |Person<>Json
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]][ Ignored character 0:1 Ignored character 0:15 Ignored character 0:23 Ignored character 0:40 Ignored character 0:42 Ignored character 0:58 Ignored character 0:172]
P>Json |{"names":["John","Doe"],"height":1.7500000000000002,"age":-1,"phones":[{"type":2,"number":"+44 1234567"},{"type":3,"number":"+44 2345678"}],"comments":"","children":[]}
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]][ Ignored character 0:167 Ignored character 0:168 Expected record 0:168]
P>JsonValue |{"age":-1,"children":[],"comments":"","height":1.7500000000000004,"names":["John","Doe"],"phones":[{"number":"+44 1234567","type":2},{"number":"+44 2345678","type":3}]}
JsonValue>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]][]
Json>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fa3fe0000063616765206670686f6e65739fbf647479706502666e756d6265726b2b34342031323334353637ffbf647479706503666e756d6265726b2b34342032333435363738ffff68636f6d6d656e747360686368696c6472656e9fffff
Json>JsonValue|{
}
[ Ignored character 0:167 Ignored character 0:168 Expected null 0:168 Expected record 0:168 Expected text 0:168 Expected boolean 0:168 Expected decimal 0:168 Expected decimal 0:168 Expected decimal 0:168 Expected null 0:168 Expected text 0:168 Expected boolean 0:168 Expected decimal 0:168 Expected decimal 0:168 Expected decimal 0:168 Expected null 0:168]
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]][ Ignored character 0:1 Ignored character 0:15 Ignored character 0:23 Ignored character 0:40 Ignored character 0:42 Ignored character 0:58 Ignored character 0:76 Ignored character 0:77]
P>Json |{"names":["John","Doe"],"height":1.7500000000000002,"age":-1,"phones":[],"comments":"","children":[]}
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]][ Ignored character 0:72 Ignored character 0:73 Expected record 0:73]
P>JsonValue |{"age":-1,"children":[],"comments":"","height":1.7500000000000004,"names":["John","Doe"],"phones":[]}
JsonValue>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]][]
Json>JsonValue|{"age":-1,"height":1.7500000000000004,"names":["John","Doe"],"phones":["comments","children"]}[ Ignored character 0:72 Ignored character 0:73 Ignored character 0:84 Ignored character 0:85 Ignored character 0:86 Ignored character 0:98 Ignored character 0:99]
Json>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fa3fe0000063616765206670686f6e65739f68636f6d6d656e7473686368696c6472656effff
group |Person<>Cbor
Cbor>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]][]
P>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765206670686f6e657382bf647479706502666e756d6265726b2b34342031323334353637ffbf647479706503666e756d6265726b2b34342032333435363738ff68636f6d6d656e747360686368696c6472656e80ff
Cbor>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]][]
QCborStream>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]]true
P>CborValue |a6656e616d657382644a6f686e63446f6566686569676874fb3ffc00000000000063616765206670686f6e657382a2647479706502666e756d6265726b2b34342031323334353637a2647479706503666e756d6265726b2b3434203233343536373868636f6d6d656e747360686368696c6472656e80
CborValue>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[ (Phone)[ type:(Home)2 number:+44 1234567] (Phone)[ type:(Office)3 number:+44 2345678]] comments: children:[]][]
Cbor>CborValue|{"names": ["John", "Doe"], "height": 1.75, "age": -1, "phones": [{"type": 2, "number": "+44 1234567"}, {"type": 3, "number": "+44 2345678"}], "comments": "", "children": []}[]
Cbor<CborValue|a6656e616d657382644a6f686e63446f6566686569676874fb3ffc00000000000063616765206670686f6e657382a2647479706502666e756d6265726b2b34342031323334353637a2647479706503666e756d6265726b2b3434203233343536373868636f6d6d656e747360686368696c6472656e80
Cbor>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]][]
P>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765206670686f6e65738068636f6d6d656e747360686368696c6472656e80ff
Cbor>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]][]
QCborStream>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]]true
P>CborValue |a6656e616d657382644a6f686e63446f6566686569676874fb3ffc00000000000063616765206670686f6e65738068636f6d6d656e747360686368696c6472656e80
CborValue>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]][]
Cbor>CborValue|{"names": ["John", "Doe"], "height": 1.75, "age": -1, "phones": [], "comments": "", "children": []}[]
CborValue>Cbor|a6656e616d657382644a6f686e63446f6566686569676874fb3ffc00000000000063616765206670686f6e65738068636f6d6d656e747360686368696c6472656e80
Cbor>Json |{"names":["John","Doe"],"height":1.75,"age":}[]
Supports Markdown
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