mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
Ref T270, performance improvement by keeping less elevations cached
Rational: the idea was to keep track of ground elevations of all aircraft and hence using them for other aircraft on ground. But the "hit" ratio is bad, so we only keep a small number of elevations ("the last ones") and use those. The size of the cache is dynamically adjusted. Not moving aircraft are still found in that much smaller list.
This commit is contained in:
@@ -109,7 +109,12 @@ namespace BlackCore
|
||||
void ISimulator::rememberElevationAndCG(const CCallsign &callsign, const Geo::CElevationPlane &elevation, const CLength &cg)
|
||||
{
|
||||
if (callsign.isEmpty()) { return; }
|
||||
if (!elevation.isNull()) { this->rememberGroundElevation(elevation); }
|
||||
if (!elevation.isNull())
|
||||
{
|
||||
const int aircraftCount = this->getAircraftInRangeCount();
|
||||
this->setRememberMaxElevations(aircraftCount * 3); // at least 3 elevations per aircraft, even better as not all are requesting elevations
|
||||
this->rememberGroundElevation(elevation);
|
||||
}
|
||||
if (!cg.isNull() && !this->hasSameCG(cg, callsign)) { this->insertCG(cg, callsign); }
|
||||
}
|
||||
|
||||
@@ -120,9 +125,11 @@ namespace BlackCore
|
||||
{
|
||||
// decouple, follow up of signal can include unloading
|
||||
// simulator so this should happen strictly asyncronously (which is like forcing Qt::QueuedConnection)
|
||||
QPointer<ISimulator> myself(this);
|
||||
QTimer::singleShot(0, this, [ = ]
|
||||
{
|
||||
emit this->simulatorStatusChanged(newStatus);
|
||||
if (!myself) { return; }
|
||||
emit myself->simulatorStatusChanged(newStatus);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user