mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Task: Remove std::map inheritance, clean up interface
- Make the Task object's interface more explicit by removing the std::map inheritance. - Using this more explicit interface, remove unneeded ctors in order to allow the compiler to "Do The Right Thing"(tm). This leads to a performance improvement of 12% in the "add" performance test, and 7% for "import".
This commit is contained in:
parent
c248a32cab
commit
8f8ad813cd
12 changed files with 64 additions and 92 deletions
12
src/TDB2.cpp
12
src/TDB2.cpp
|
@ -990,11 +990,11 @@ void TDB2::show_diff (
|
|||
Task before (prior);
|
||||
|
||||
std::vector <std::string> beforeAtts;
|
||||
for (auto& att : before)
|
||||
for (auto& att : before.data)
|
||||
beforeAtts.push_back (att.first);
|
||||
|
||||
std::vector <std::string> afterAtts;
|
||||
for (auto& att : after)
|
||||
for (auto& att : after.data)
|
||||
afterAtts.push_back (att.first);
|
||||
|
||||
std::vector <std::string> beforeOnly;
|
||||
|
@ -1009,7 +1009,7 @@ void TDB2::show_diff (
|
|||
view.set (row, 1, renderAttribute (name, before.get (name)), color_red);
|
||||
}
|
||||
|
||||
for (auto& att : before)
|
||||
for (auto& att : before.data)
|
||||
{
|
||||
std::string priorValue = before.get (att.first);
|
||||
std::string currentValue = after.get (att.first);
|
||||
|
@ -1035,7 +1035,7 @@ void TDB2::show_diff (
|
|||
else
|
||||
{
|
||||
int row;
|
||||
for (auto& att : after)
|
||||
for (auto& att : after.data)
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, att.first);
|
||||
|
@ -1093,11 +1093,11 @@ void TDB2::show_diff (
|
|||
std::vector <std::string> all = context.getColumns ();
|
||||
|
||||
// Now factor in the annotation attributes.
|
||||
for (auto& it : before)
|
||||
for (auto& it : before.data)
|
||||
if (it.first.substr (0, 11) == "annotation_")
|
||||
all.push_back (it.first);
|
||||
|
||||
for (auto& it : after)
|
||||
for (auto& it : after.data)
|
||||
if (it.first.substr (0, 11) == "annotation_")
|
||||
all.push_back (it.first);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue