src: Improved project load speed with move semantics and in-place initialization

* switched SearchIndex and HierarchyCache to std::unique_ptr
* use move semantics and in-place initialization in StorageTypes and SearchIndex
* improved autocompletion speed by fixing contained node type checking
This commit is contained in:
Eberhard Graether
2018-07-22 00:25:54 +02:00
parent 46e6b8ff14
commit 0b5ad33a8c
20 changed files with 204 additions and 185 deletions
+4 -3
View File
@@ -2,6 +2,7 @@
#include "data/name/NameHierarchy.h"
#include "data/search/SearchIndex.h"
#include "utility/utility.h"
class SearchIndexTestSuite : public CxxTest::TestSuite
{
@@ -16,7 +17,7 @@ public:
TS_ASSERT_EQUALS(1, results.size());
TS_ASSERT_EQUALS(1, results[0].elementIds.size());
TS_ASSERT_DIFFERS(results[0].elementIds.end(), results[0].elementIds.find(1));
TS_ASSERT(utility::containsElement<Id>(results[0].elementIds, 1));
}
void test_search_index_finds_correct_indices_for_query()
@@ -42,9 +43,9 @@ public:
TS_ASSERT_EQUALS(2, results.size());
TS_ASSERT_EQUALS(1, results[0].elementIds.size());
TS_ASSERT_DIFFERS(results[0].elementIds.end(), results[0].elementIds.find(1));
TS_ASSERT(utility::containsElement<Id>(results[0].elementIds, 1));
TS_ASSERT_EQUALS(1, results[1].elementIds.size());
TS_ASSERT_DIFFERS(results[1].elementIds.end(), results[1].elementIds.find(2));
TS_ASSERT(utility::containsElement<Id>(results[1].elementIds, 2));
}
void test_search_index_does_not_find_anything_after_clear()