Commit 0d92bae2 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère
Browse files

Added a superfluous item that QBind<QJsonReader,Person> ignores

Added one decimal to better measure performance which is now close to a
few µsec
parent 56b82d19
......@@ -118,7 +118,7 @@ private:
// NB: It is not possible to use QBENCHMARK to item qDebug because it installs a specific handler
#define GROUP(group) { \
qint64 previousTotal=0, groupTotal=0; \
float previousTotal=0, groupTotal=0; \
bool groupWarmup; \
do { \
groupWarmup=(previousTotal==0 || abs(groupTotal-previousTotal)*100/previousTotal > 1); \
......@@ -127,14 +127,14 @@ private:
if (!previousTotal) { fprintf(results,"group "); fprintf(samples, "group |%s\n", group); } else fprintf(results,"%-10s",group);
#define GROUP_STOP \
if (!previousTotal) fprintf(results,"|total(usecs)|variation(%%)\n"); else fprintf(results,"|%12lld|%3lld\n", groupTotal, previousTotal ? abs(groupTotal-previousTotal)*100/previousTotal : 0); \
if (!previousTotal) fprintf(results,"|total(usecs)|variation(%%)\n"); else fprintf(results,"|%12.1f|%5.1f\n", groupTotal, previousTotal ? abs(groupTotal-previousTotal)*100/previousTotal : 0); \
} while (groupWarmup); }
QElapsedTimer item;
#define START item.start(); for (int i=0; i<123; ++i)
#define STOP(label,result) { \
auto usecs=item.nsecsElapsed()/1000/123; groupTotal+=usecs; \
if (!previousTotal) { fprintf(results,"|%14s", label); fprintf(samples, "%-14s|%s\n", label, qPrintable(result)); } else fprintf(results,"|%14lld", usecs); }
auto usecs=float(item.nsecsElapsed())/1000/123; groupTotal+=usecs; \
if (!previousTotal) { fprintf(results,"|%14s", label); fprintf(samples, "%-14s|%s\n", label, qPrintable(result)); } else fprintf(results,"|%14.1f", usecs); }
int main()
{
......@@ -300,7 +300,7 @@ int main()
{
QBuffer json;
json.open(QIODevice::ReadOnly);
json.buffer() = "_[ _\"John\" _, \"Doe\" , _1.75 , [ \"+44 1234567\" , \"+44 2345678\" ] _] ";
json.buffer() = "_[ _\"John\" _, \"Doe\" , _1.75 , [ \"+44 1234567\" , \"+44 2345678\" ], \"superfluous item\" _] ";
Person p;
QVector<QTextReadError> errors;
START {
......
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