mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-08 18:55:36 +08:00
refs #721 JSON performance samples.
This commit is contained in:
@@ -48,6 +48,7 @@ int main(int argc, char *argv[])
|
||||
qtout << "6b .. 25/100 Performance impl. type" << endl;
|
||||
qtout << "6c .. 25/20 Performance impl. type" << endl;
|
||||
qtout << "6d .. 40/20 Interpolator scenario" << endl;
|
||||
qtout << "6e .. JSON performance" << endl;
|
||||
qtout << "7 .. Algorithms" << endl;
|
||||
qtout << "-----" << endl;
|
||||
qtout << "x .. Bye" << endl;
|
||||
@@ -61,6 +62,7 @@ int main(int argc, char *argv[])
|
||||
else if (s.startsWith("6b")) { CSamplesPerformance::samplesImplementationType(qtout, 25, 100); }
|
||||
else if (s.startsWith("6c")) { CSamplesPerformance::samplesImplementationType(qtout, 25, 20); }
|
||||
else if (s.startsWith("6d")) { CSamplesPerformance::interpolatorScenario(qtout, 40, 20); }
|
||||
else if (s.startsWith("6e")) { CSamplesPerformance::samplesJson(qtout); }
|
||||
else if (s.startsWith("7")) { CSamplesAlgorithm::samples(); }
|
||||
else if (s.startsWith("x")) { break; }
|
||||
}
|
||||
|
||||
@@ -324,6 +324,22 @@ namespace BlackSample
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CSamplesPerformance::samplesJson(QTextStream &out)
|
||||
{
|
||||
QTime timer;
|
||||
auto situations = createSituations(0, 10000, 10);
|
||||
|
||||
timer.start();
|
||||
QString s = situations.toJsonString();
|
||||
out << "Convert 100,000 aircraft situations to JSON: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
situations.convertFromJson(s);
|
||||
out << "Convert 100,000 aircraft situations from JSON: " << timer.elapsed() << "ms" << endl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CAircraftSituationList CSamplesPerformance::createSituations(qint64 baseTimeEpoch, int numberOfCallsigns, int numberOfTimes)
|
||||
{
|
||||
CAircraftSituationList situations;
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace BlackSample
|
||||
//! Interpolator scenario
|
||||
static int interpolatorScenario(QTextStream &out, int numberOfCallsigns, int numberOfTimes);
|
||||
|
||||
//! JSON (de)serialization
|
||||
static int samplesJson(QTextStream &out);
|
||||
|
||||
//! Situation values for testing
|
||||
static BlackMisc::Aviation::CAircraftSituationList createSituations(qint64 baseTimeEpoch, int numberOfCallsigns, int numberOfTimes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user