1
0
Fork 0

Reduce CPU hit in FGTaxiSegment::unblock

size() is O(N), empty() is constant time.
This commit is contained in:
James Turner 2018-09-02 19:56:26 +01:00
parent 95be7220a2
commit 35c5be004f

View file

@ -121,15 +121,13 @@ bool FGTaxiSegment::hasBlock(time_t now)
void FGTaxiSegment::unblock(time_t now) void FGTaxiSegment::unblock(time_t now)
{ {
if (blockTimes.size()) { if (blockTimes.empty())
BlockListIterator i = blockTimes.begin(); return;
if (i->getTimeStamp() < (now - 30)) {
blockTimes.erase(i);
}
}
}
if (blockTimes.front().getTimeStamp() < (now - 30)) {
blockTimes.erase(blockTimes.begin());
}
}
/*************************************************************************** /***************************************************************************
* FGTaxiRoute * FGTaxiRoute