TDB2: Improve TF2::get(uuid, task) performance

- Improves "task import" performance test on test machine further from
  13s to 1.9s.
- Active only during "task import".  Might be worth using during other
  mass lookups like "task sync", or could even be a good default.
This commit is contained in:
Wilhelm Schuermann 2015-09-22 18:25:34 +02:00
parent d006a2820b
commit 4fb9307be5
2 changed files with 42 additions and 4 deletions

View file

@ -28,6 +28,7 @@
#define INCLUDED_TDB2
#include <map>
#include <unordered_map>
#include <vector>
#include <string>
#include <stdio.h>
@ -81,6 +82,12 @@ public:
bool _has_ids;
bool _auto_dep_scan;
std::vector <Task> _tasks;
// _tasks_map was introduced mainly for speeding up "task import".
// Iterating over all _tasks for each imported task is slow, making use of
// appropriate data structures is fast.
std::unordered_map <std::string, Task> _tasks_map;
std::vector <Task> _added_tasks;
std::vector <Task> _modified_tasks;
std::vector <std::string> _lines;