mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
Ref T275 testaircraftsituation: detach lists to get meaningful benchmark results.
This commit is contained in:
@@ -262,6 +262,9 @@ namespace BlackMisc
|
|||||||
return this->to(QList<T>());
|
return this->to(QList<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \private Calls detach on the internal QMap.
|
||||||
|
void detach() { m_impl.detach(); }
|
||||||
|
|
||||||
//! Test for equality.
|
//! Test for equality.
|
||||||
bool operator ==(const CCollection &other) const { return m_impl == other.m_impl; }
|
bool operator ==(const CCollection &other) const { return m_impl == other.m_impl; }
|
||||||
|
|
||||||
|
|||||||
@@ -533,6 +533,9 @@ namespace BlackMisc
|
|||||||
return separateBy([k](const T &v) { return v.*k; });
|
return separateBy([k](const T &v) { return v.*k; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \private Calls detach on the internal QVector.
|
||||||
|
void detach() { m_impl.detach(); }
|
||||||
|
|
||||||
//! Equals operator.
|
//! Equals operator.
|
||||||
friend bool operator ==(const CSequence &a, const CSequence &b) { return a.m_impl == b.m_impl; }
|
friend bool operator ==(const CSequence &a, const CSequence &b) { return a.m_impl == b.m_impl; }
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ namespace BlackMiscTest
|
|||||||
|
|
||||||
void CTestAircraftSituation::sortHint()
|
void CTestAircraftSituation::sortHint()
|
||||||
{
|
{
|
||||||
constexpr int Max = 500000;
|
constexpr int Max = 50000;
|
||||||
CAircraftSituationList situations = testSituations();
|
CAircraftSituationList situations = testSituations();
|
||||||
situations.sortAdjustedLatestFirst();
|
situations.sortAdjustedLatestFirst();
|
||||||
CSequence<CAircraftSituationList> listOfLists1;
|
CSequence<CAircraftSituationList> listOfLists1;
|
||||||
@@ -238,6 +238,8 @@ namespace BlackMiscTest
|
|||||||
{
|
{
|
||||||
listOfLists1.push_back(situations);
|
listOfLists1.push_back(situations);
|
||||||
listOfLists2.push_back(situations);
|
listOfLists2.push_back(situations);
|
||||||
|
listOfLists1.back().detach();
|
||||||
|
listOfLists2.back().detach();
|
||||||
listOfLists2.back().setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
|
listOfLists2.back().setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,11 +263,12 @@ namespace BlackMiscTest
|
|||||||
const int hint = time.elapsed();
|
const int hint = time.elapsed();
|
||||||
const double ratio = static_cast<double>(hint) / static_cast<double>(noHint); // expected <1.0
|
const double ratio = static_cast<double>(hint) / static_cast<double>(noHint); // expected <1.0
|
||||||
|
|
||||||
qDebug() << "MacOS:" << boolToYesNo(CBuildConfig::isRunningOnMacOSPlatform());
|
//qDebug() << "MacOS:" << boolToYesNo(CBuildConfig::isRunningOnMacOSPlatform());
|
||||||
qDebug() << "Access without hint" << noHint << "ms";
|
qDebug() << "Access without hint" << noHint << "ms";
|
||||||
qDebug() << "Access with hint" << hint << "ms";
|
qDebug() << "Access with hint" << hint << "ms";
|
||||||
qDebug() << "Access ratio" << ratio;
|
qDebug() << "Access ratio" << ratio;
|
||||||
|
|
||||||
|
#if 0
|
||||||
// remark On Win/Linux access with hint is faster
|
// remark On Win/Linux access with hint is faster
|
||||||
// on MacOS the times are the same, maybe with hint it is even slightly slower
|
// on MacOS the times are the same, maybe with hint it is even slightly slower
|
||||||
if (noHint >= hint)
|
if (noHint >= hint)
|
||||||
@@ -281,6 +284,7 @@ namespace BlackMiscTest
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QVERIFY2(hint <= noHint, "Expected hinted sort being faster");
|
QVERIFY2(hint <= noHint, "Expected hinted sort being faster");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user