data: optimize memory of sqlite database
* use sqlite "VACUUM" after analysis to reduce memory size * only add filename to name of local symbol
This commit is contained in:
@@ -34,7 +34,11 @@ void TaskParseWrapper::exit()
|
||||
{
|
||||
m_child->exit();
|
||||
|
||||
MessageStatus("building search index", false, true).dispatch();
|
||||
MessageStatus("optimizing database", false, true).dispatch();
|
||||
|
||||
m_storage->optimizeMemory();
|
||||
|
||||
MessageStatus("building caches", false, true).dispatch();
|
||||
|
||||
m_storage->finishParsing();
|
||||
|
||||
|
||||
@@ -360,6 +360,11 @@ void PersistentStorage::finishParsing()
|
||||
optimizeFTSTable();
|
||||
}
|
||||
|
||||
void PersistentStorage::optimizeMemory()
|
||||
{
|
||||
m_sqliteStorage.optimizeMemory();
|
||||
}
|
||||
|
||||
Id PersistentStorage::getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const
|
||||
{
|
||||
return m_sqliteStorage.getNodeBySerializedName(NameHierarchy::serialize(nameHierarchy)).id;
|
||||
|
||||
@@ -69,6 +69,8 @@ public:
|
||||
void startParsing();
|
||||
void finishParsing();
|
||||
|
||||
void optimizeMemory();
|
||||
|
||||
// StorageAccess implementation
|
||||
virtual Id getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const;
|
||||
virtual Id getIdForEdge(
|
||||
|
||||
@@ -361,6 +361,18 @@ std::vector<StorageEdge> SqliteStorage::getEdgesByTargetType(Id targetId, int ty
|
||||
return getAll<StorageEdge>("WHERE target_node_id == " + std::to_string(targetId) + " AND type == " + std::to_string(type));
|
||||
}
|
||||
|
||||
void SqliteStorage::optimizeMemory() const
|
||||
{
|
||||
try
|
||||
{
|
||||
m_database.execDML("VACUUM;");
|
||||
}
|
||||
catch(CppSQLite3Exception e)
|
||||
{
|
||||
LOG_ERROR(e.errorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void SqliteStorage::optimizeFTSTable() const
|
||||
{
|
||||
try
|
||||
|
||||
@@ -95,6 +95,8 @@ public:
|
||||
StorageComponentAccess getComponentAccessByMemberEdgeId(Id memberEdgeId) const;
|
||||
std::vector<StorageComponentAccess> getComponentAccessByMemberEdgeIds(const std::vector<Id>& memberEdgeIds) const;
|
||||
|
||||
void optimizeMemory() const;
|
||||
|
||||
std::vector<ParseLocation> getFullTextSearch(const std::string& searchTerm) const;
|
||||
void optimizeFTSTable() const;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ class TaskParseWrapper
|
||||
: public Task
|
||||
{
|
||||
public:
|
||||
|
||||
TaskParseWrapper(
|
||||
std::shared_ptr<Task> child,
|
||||
PersistentStorage* storage,
|
||||
|
||||
@@ -1148,7 +1148,7 @@ void ASTVisitor::RecordDeclRef(
|
||||
{
|
||||
ParseLocation declLocation = getParseLocation(varDecl->getSourceRange());
|
||||
std::string name =
|
||||
declLocation.filePath.str() + "::" +
|
||||
declLocation.filePath.fileName() + "::" +
|
||||
varDecl->getNameAsString() + "<" +
|
||||
std::to_string(declLocation.startLineNumber) + ":" +
|
||||
std::to_string(declLocation.startColumnNumber) + ">";
|
||||
|
||||
Reference in New Issue
Block a user