Bug #1166, slow POI parsing.
Various tweaks and changes to make it easier to evaluate changes to the rebuild code. No smoking gun found yet.
This commit is contained in:
parent
6810809170
commit
ac8869cd62
1 changed files with 64 additions and 44 deletions
|
@ -74,7 +74,7 @@ namespace {
|
||||||
|
|
||||||
const int MAX_RETRIES = 10;
|
const int MAX_RETRIES = 10;
|
||||||
const int SCHEMA_VERSION = 8;
|
const int SCHEMA_VERSION = 8;
|
||||||
const int CACHE_SIZE_KBYTES= 16000;
|
const int CACHE_SIZE_KBYTES= 32 * 1024;
|
||||||
|
|
||||||
// bind a std::string to a sqlite statement. The std::string must live the
|
// bind a std::string to a sqlite statement. The std::string must live the
|
||||||
// entire duration of the statement execution - do not pass a temporary
|
// entire duration of the statement execution - do not pass a temporary
|
||||||
|
@ -1065,7 +1065,6 @@ FGPositioned* NavDataCache::NavDataCachePrivate::loadById(sqlite3_int64 rowid)
|
||||||
if (aptId > 0) {
|
if (aptId > 0) {
|
||||||
FGAirport* apt = FGPositioned::loadById<FGAirport>(aptId);
|
FGAirport* apt = FGPositioned::loadById<FGAirport>(aptId);
|
||||||
if (apt->validateILSData()) {
|
if (apt->validateILSData()) {
|
||||||
SG_LOG(SG_NAVCACHE, SG_INFO, "re-loaded ILS data for " << apt->ident());
|
|
||||||
// queried data above is probably invalid, force us to go around again
|
// queried data above is probably invalid, force us to go around again
|
||||||
// (the next time through, validateILSData will return false)
|
// (the next time through, validateILSData will return false)
|
||||||
return outer->loadById(rowid);
|
return outer->loadById(rowid);
|
||||||
|
@ -1228,55 +1227,76 @@ void NavDataCache::doRebuild()
|
||||||
try {
|
try {
|
||||||
d->close(); // completely close the sqlite object
|
d->close(); // completely close the sqlite object
|
||||||
d->path.remove(); // remove the file on disk
|
d->path.remove(); // remove the file on disk
|
||||||
d->init(); // star again from scratch
|
d->init(); // start again from scratch
|
||||||
|
|
||||||
Transaction txn(this);
|
// initialise the root octree node
|
||||||
// initialise the root octree node
|
|
||||||
d->runSQL("INSERT INTO octree (rowid, children) VALUES (1, 0)");
|
d->runSQL("INSERT INTO octree (rowid, children) VALUES (1, 0)");
|
||||||
|
|
||||||
SGTimeStamp st;
|
SGTimeStamp st;
|
||||||
st.stamp();
|
{
|
||||||
|
Transaction txn(this);
|
||||||
airportDBLoad(d->aptDatPath);
|
|
||||||
SG_LOG(SG_NAVCACHE, SG_INFO, "apt.dat load took:" << st.elapsedMSec());
|
st.stamp();
|
||||||
|
airportDBLoad(d->aptDatPath);
|
||||||
metarDataLoad(d->metarDatPath);
|
SG_LOG(SG_NAVCACHE, SG_INFO, "apt.dat load took:" << st.elapsedMSec());
|
||||||
stampCacheFile(d->aptDatPath);
|
|
||||||
stampCacheFile(d->metarDatPath);
|
metarDataLoad(d->metarDatPath);
|
||||||
|
stampCacheFile(d->aptDatPath);
|
||||||
st.stamp();
|
stampCacheFile(d->metarDatPath);
|
||||||
loadFixes(d->fixDatPath);
|
|
||||||
stampCacheFile(d->fixDatPath);
|
st.stamp();
|
||||||
SG_LOG(SG_NAVCACHE, SG_INFO, "fix.dat load took:" << st.elapsedMSec());
|
loadFixes(d->fixDatPath);
|
||||||
|
stampCacheFile(d->fixDatPath);
|
||||||
st.stamp();
|
SG_LOG(SG_NAVCACHE, SG_INFO, "fix.dat load took:" << st.elapsedMSec());
|
||||||
navDBInit(d->navDatPath);
|
|
||||||
stampCacheFile(d->navDatPath);
|
st.stamp();
|
||||||
SG_LOG(SG_NAVCACHE, SG_INFO, "nav.dat load took:" << st.elapsedMSec());
|
navDBInit(d->navDatPath);
|
||||||
|
stampCacheFile(d->navDatPath);
|
||||||
|
SG_LOG(SG_NAVCACHE, SG_INFO, "nav.dat load took:" << st.elapsedMSec());
|
||||||
|
|
||||||
|
st.stamp();
|
||||||
|
txn.commit();
|
||||||
|
SG_LOG(SG_NAVCACHE, SG_INFO, "stage 1 commit took:" << st.elapsedMSec());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SG_WINDOWS
|
#ifdef SG_WINDOWS
|
||||||
SG_LOG(SG_NAVCACHE, SG_ALERT, "SKIPPING POI load on Windows");
|
SG_LOG(SG_NAVCACHE, SG_ALERT, "SKIPPING POI load on Windows");
|
||||||
#else
|
#else
|
||||||
st.stamp();
|
{
|
||||||
poiDBInit(d->poiDatPath);
|
Transaction txn(this);
|
||||||
stampCacheFile(d->poiDatPath);
|
|
||||||
SG_LOG(SG_NAVCACHE, SG_INFO, "poi.dat load took:" << st.elapsedMSec());
|
st.stamp();
|
||||||
|
poiDBInit(d->poiDatPath);
|
||||||
|
stampCacheFile(d->poiDatPath);
|
||||||
|
SG_LOG(SG_NAVCACHE, SG_INFO, "poi.dat load took:" << st.elapsedMSec());
|
||||||
|
|
||||||
|
st.stamp();
|
||||||
|
txn.commit();
|
||||||
|
SG_LOG(SG_NAVCACHE, SG_INFO, "POI commit took:" << st.elapsedMSec());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
loadCarrierNav(d->carrierDatPath);
|
{
|
||||||
stampCacheFile(d->carrierDatPath);
|
Transaction txn(this);
|
||||||
|
loadCarrierNav(d->carrierDatPath);
|
||||||
st.stamp();
|
stampCacheFile(d->carrierDatPath);
|
||||||
Airway::load(d->airwayDatPath);
|
|
||||||
stampCacheFile(d->airwayDatPath);
|
st.stamp();
|
||||||
SG_LOG(SG_NAVCACHE, SG_INFO, "awy.dat load took:" << st.elapsedMSec());
|
Airway::load(d->airwayDatPath);
|
||||||
|
stampCacheFile(d->airwayDatPath);
|
||||||
d->flushDeferredOctreeUpdates();
|
SG_LOG(SG_NAVCACHE, SG_INFO, "awy.dat load took:" << st.elapsedMSec());
|
||||||
|
|
||||||
string sceneryPaths = simgear::strutils::join(globals->get_fg_scenery(), ";");
|
d->flushDeferredOctreeUpdates();
|
||||||
writeStringProperty("scenery_paths", sceneryPaths);
|
|
||||||
|
string sceneryPaths = simgear::strutils::join(globals->get_fg_scenery(), ";");
|
||||||
txn.commit();
|
writeStringProperty("scenery_paths", sceneryPaths);
|
||||||
|
|
||||||
|
st.stamp();
|
||||||
|
txn.commit();
|
||||||
|
SG_LOG(SG_NAVCACHE, SG_INFO, "final commit took:" << st.elapsedMSec());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} catch (sg_exception& e) {
|
} catch (sg_exception& e) {
|
||||||
SG_LOG(SG_NAVCACHE, SG_ALERT, "caught exception rebuilding navCache:" << e.what());
|
SG_LOG(SG_NAVCACHE, SG_ALERT, "caught exception rebuilding navCache:" << e.what());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue