mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Performance
- Introduced a new filter optimization that recognizes filters with no 'OR', or 'XOR' operators, includes IDs, but does not include UUIDs. This combination means completed.data is not referenced.
This commit is contained in:
parent
35122154ef
commit
139011e1ae
2 changed files with 33 additions and 2 deletions
|
@ -9,6 +9,9 @@ Features
|
|||
+ Added the new 'indented' format for the 'project' attribute.
|
||||
+ The 'projects' report now uses 'project.indented' format.
|
||||
+ The 'summary' report now uses 'project.indented' format.
|
||||
+ Introduced a new filter optimization that recognizes filters with no 'OR', or
|
||||
'XOR' operators, includes IDs, but does not include UUIDs. This combination
|
||||
means completed.data is not referenced.
|
||||
|
||||
Bugs
|
||||
+ Fixed bug #964, where the 'projects' command showed the wrong priority labels
|
||||
|
|
|
@ -338,8 +338,6 @@ void Command::filter (std::vector <Task>& output)
|
|||
if (e.evalFilter (*task))
|
||||
output.push_back (*task);
|
||||
}
|
||||
else
|
||||
context.debug ("Command::filter skipping completed.data");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -372,7 +370,37 @@ bool Command::filter_shortcut (const A3& filter)
|
|||
filter[0]._raw == "status" &&
|
||||
filter[1]._raw.find ("pending") != std::string::npos &&
|
||||
filter[2]._raw == "=")
|
||||
{
|
||||
context.debug ("Command::filter skipping completed.data (status:pending only)");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Shortcut: If the filter contains no 'or' or 'xor' operators, IDs and no UUIDs.
|
||||
int countId = 0;
|
||||
int countUUID = 0;
|
||||
int countOr = 0;
|
||||
int countXor = 0;
|
||||
std::vector <Arg>::const_iterator i;
|
||||
for (i = filter.begin (); i != filter.end (); ++i)
|
||||
{
|
||||
if (i->_category == Arg::cat_op)
|
||||
{
|
||||
if (i->_raw == "or") ++countOr;
|
||||
if (i->_raw == "xor") ++countXor;
|
||||
|
||||
}
|
||||
else if (i->_category == Arg::cat_id) ++countId;
|
||||
else if (i->_category == Arg::cat_uuid) ++countUUID;
|
||||
}
|
||||
|
||||
if (countOr == 0 &&
|
||||
countXor == 0 &&
|
||||
countUUID == 0 &&
|
||||
countId > 0)
|
||||
{
|
||||
context.debug ("Command::filter skipping completed.data (IDs, no OR, no XOR, no UUID)");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue