Hi @MrHandSOme,
I calculate by putting qtime in the upper and lower parts.
QTime has some overhead (probably very little, but still...). For interest, try this:
const quint64 start = QDateTime::currentMSecsSinceEpoch();
QJsonObject rootObj; qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "rootObj";
rootObj[QStringLiteral("a1")]=QStringLiteral("a1obj"); qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "a1obj";
rootObj[QStringLiteral("a2")]=QStringLiteral("a2obj"); qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "a2obj";
rootObj[QStringLiteral("a3")]=QStringLiteral("a3obj"); qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "a3obj";
rootObj[QStringLiteral("a4")]=QStringLiteral("a4obj"); qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "a4obj";
rootObj[QStringLiteral("a5")]=QStringLiteral("a5obj"); qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "a5obj";
QJsonDocument newDocument(rootObj); qDebug() << (QDateTime::currentMSecsSinceEpoch()-start) << "newDocument";
For me (on Linux though, I don't have Windows handy just at the moment), it shows all of that code executing within a single millisecond, as expected. My output:
0 rootObj
1 a1obj
1 a2obj
1 a3obj
1 a4obj
1 a5obj
1 newDocument
If that code is slow for you, show us the output. If it's not slow, then try replacing the various QStringLiteral()'s with your versions one at a time and see if that reveals anything.
Cheers.