mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Performance
- Optimizes indexing into pending.data for direct task access.
This commit is contained in:
parent
2ce8f4a416
commit
d211337315
2 changed files with 9 additions and 4 deletions
|
@ -48,6 +48,8 @@ Features
|
||||||
+ Rewritten task-sync(5) man page, listing sync options and setup guidelines..
|
+ Rewritten task-sync(5) man page, listing sync options and setup guidelines..
|
||||||
+ Now properly uses the libc version of uuid_create and uuid_to_string for
|
+ Now properly uses the libc version of uuid_create and uuid_to_string for
|
||||||
FreeBSD (thanks to Pietro Cerutti).
|
FreeBSD (thanks to Pietro Cerutti).
|
||||||
|
+ Performance improvements:
|
||||||
|
+ Optimizes indexing into pending.data for direct task access.
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
+ #1195 Random seed not random enough - removed all random number code (thanks
|
+ #1195 Random seed not random enough - removed all random number code (thanks
|
||||||
|
|
11
src/TDB2.cpp
11
src/TDB2.cpp
|
@ -112,12 +112,15 @@ bool TF2::get (int id, Task& task)
|
||||||
if (! _loaded_tasks)
|
if (! _loaded_tasks)
|
||||||
load_tasks ();
|
load_tasks ();
|
||||||
|
|
||||||
std::vector <Task>::iterator i;
|
// This is an optimization. Since the 'id' is based on the line number of
|
||||||
for (i = _tasks.begin (); i != _tasks.end (); ++i)
|
// pending.data file, the task in question cannot appear earlier than line
|
||||||
|
// (id - 1) in the file. It can, however, appear significantly later because
|
||||||
|
// it is not known how recent a GC operation was run.
|
||||||
|
for (int i = id - 1; i < _tasks.size (); ++i)
|
||||||
{
|
{
|
||||||
if (i->id == id)
|
if (_tasks[i].id == id)
|
||||||
{
|
{
|
||||||
task = *i;
|
task = _tasks[i];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue