mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Removed type erasure in containers
Summary: Refs T196 Using QVector as this is Qt's recommended container type. Reviewers: #swift_developers, rwinklmeier Reviewed By: #swift_developers, rwinklmeier Subscribers: rwinklmeier, jenkins Tags: #swift_pilot_client Maniphest Tasks: T196 Differential Revision: https://dev.swift-project.org/D61
This commit is contained in:
@@ -48,13 +48,11 @@ int main(int argc, char *argv[])
|
||||
qtout << "3 .. Containers" << endl;
|
||||
qtout << "4 .. Metadata" << endl;
|
||||
qtout << "6a .. Performance create / copy / ..." << endl;
|
||||
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 << "6f .. JSON model performance (database vs. own JSON)" << endl;
|
||||
qtout << "6g .. string utils vs.regex" << endl;
|
||||
qtout << "6h .. string concatenation (+=, arg, ..)" << endl;
|
||||
qtout << "6b .. 40/20 Interpolator scenario" << endl;
|
||||
qtout << "6c .. JSON performance" << endl;
|
||||
qtout << "6d .. JSON model performance (database vs. own JSON)" << endl;
|
||||
qtout << "6e .. string utils vs.regex" << endl;
|
||||
qtout << "6f .. string concatenation (+=, arg, ..)" << endl;
|
||||
qtout << "7 .. Algorithms" << endl;
|
||||
qtout << "-----" << endl;
|
||||
qtout << "x .. Bye" << endl;
|
||||
@@ -65,13 +63,11 @@ int main(int argc, char *argv[])
|
||||
else if (s.startsWith("3")) { CSamplesContainer::samples(); }
|
||||
else if (s.startsWith("4")) { CSamplesMetadata::samples(); }
|
||||
else if (s.startsWith("6a")) { CSamplesPerformance::samplesMisc(qtout); }
|
||||
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("6f")) { CSamplesPerformance::samplesJsonModel(qtout); }
|
||||
else if (s.startsWith("6g")) { CSamplesPerformance::samplesStringUtilsVsRegEx(qtout); }
|
||||
else if (s.startsWith("6h")) { CSamplesPerformance::samplesStringConcat(qtout); }
|
||||
else if (s.startsWith("6b")) { CSamplesPerformance::interpolatorScenario(qtout, 40, 20); }
|
||||
else if (s.startsWith("6c")) { CSamplesPerformance::samplesJson(qtout); }
|
||||
else if (s.startsWith("6d")) { CSamplesPerformance::samplesJsonModel(qtout); }
|
||||
else if (s.startsWith("6e")) { CSamplesPerformance::samplesStringUtilsVsRegEx(qtout); }
|
||||
else if (s.startsWith("6f")) { CSamplesPerformance::samplesStringConcat(qtout); }
|
||||
else if (s.startsWith("7")) { CSamplesAlgorithm::samples(); }
|
||||
else if (s.startsWith("x")) { break; }
|
||||
}
|
||||
|
||||
@@ -184,101 +184,6 @@ namespace BlackSample
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CSamplesPerformance::samplesImplementationType(QTextStream &out, int numberOfCallsigns, int numberOfTimes)
|
||||
{
|
||||
const qint64 baseTimeEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||
CAircraftSituationList situations = createSituations(baseTimeEpoch, numberOfCallsigns, numberOfTimes);
|
||||
|
||||
QTime timer;
|
||||
out << "Created " << situations.size() << " situations" << endl;
|
||||
|
||||
timer.start();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
for (int cs = 0; cs < numberOfCallsigns; cs++)
|
||||
{
|
||||
CCallsign callsign("CS" + QString::number(cs));
|
||||
CAircraftSituationList r = situations.findByCallsign(callsign);
|
||||
Q_ASSERT(r.size() == numberOfTimes);
|
||||
}
|
||||
}
|
||||
out << "Reads by callsigns: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
for (int t = 0; t < numberOfTimes; t++)
|
||||
{
|
||||
CAircraftSituationList r = situations.findBefore(baseTimeEpoch + 1 + (DeltaTime * t));
|
||||
Q_ASSERT(r.size() == numberOfCallsigns * (t + 1));
|
||||
}
|
||||
}
|
||||
out << "Reads by times: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
for (int t = 0; t < numberOfTimes; t++)
|
||||
{
|
||||
for (int cs = 0; cs < numberOfCallsigns; cs++)
|
||||
{
|
||||
CCallsign callsign("CS" + QString::number(cs));
|
||||
CAircraftSituationList r = situations.findByCallsign(callsign).findBefore(baseTimeEpoch + 1 + (DeltaTime * t));
|
||||
Q_UNUSED(r);
|
||||
}
|
||||
}
|
||||
out << "Reads by callsigns / times: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
for (int t = 0; t < numberOfTimes; t++)
|
||||
{
|
||||
for (int cs = 0; cs < numberOfCallsigns; cs++)
|
||||
{
|
||||
CCallsign callsign("CS" + QString::number(cs));
|
||||
CAircraftSituationList r = situations.findBefore(baseTimeEpoch + 1 + (DeltaTime * t)).findByCallsign(callsign);
|
||||
Q_UNUSED(r);
|
||||
}
|
||||
}
|
||||
out << "Reads by times / callsigns: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
const QHash<CCallsign, CAircraftSituationList> splitList = situations.splitPerCallsign();
|
||||
Q_ASSERT(splitList.size() == numberOfCallsigns);
|
||||
for (int t = 0; t < numberOfTimes; t++)
|
||||
{
|
||||
for (const CAircraftSituationList &slcs : splitList)
|
||||
{
|
||||
CAircraftSituationList r = slcs.findBefore(baseTimeEpoch + 1 + (DeltaTime * t));
|
||||
Q_UNUSED(r);
|
||||
}
|
||||
}
|
||||
out << "Split reads by callsigns / times: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
situations.changeImpl<QVector<CAircraftSituation> >();
|
||||
out << "Changed to QVector" << endl;
|
||||
timer.start();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
for (int cs = 0; cs < numberOfCallsigns; cs++)
|
||||
{
|
||||
CCallsign callsign("CS" + QString::number(cs));
|
||||
CAircraftSituationList r = situations.findByCallsign(callsign);
|
||||
Q_ASSERT(r.size() == numberOfTimes);
|
||||
}
|
||||
}
|
||||
out << "Reads by callsigns: " << timer.elapsed() << "ms" << endl;
|
||||
|
||||
timer.start();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
for (int t = 0; t < numberOfTimes; t++)
|
||||
{
|
||||
CAircraftSituationList r = situations.findBefore(baseTimeEpoch + 1 + (DeltaTime * t));
|
||||
Q_ASSERT(r.size() == numberOfCallsigns * (t + 1));
|
||||
}
|
||||
}
|
||||
out << "Reads by times: " << timer.elapsed() << "ms" << endl << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CSamplesPerformance::interpolatorScenario(QTextStream &out, int numberOfCallsigns, int numberOfTimes)
|
||||
{
|
||||
const qint64 baseTimeEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
@@ -29,9 +29,6 @@ namespace BlackSample
|
||||
//! Copy, create, RegEx
|
||||
static int samplesMisc(QTextStream &out);
|
||||
|
||||
//! Impact of implementation type
|
||||
static int samplesImplementationType(QTextStream &out, int numberOfCallsigns, int numberOfTimes);
|
||||
|
||||
//! Interpolator scenario
|
||||
static int interpolatorScenario(QTextStream &out, int numberOfCallsigns, int numberOfTimes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user