mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-06 17:37:21 +02:00
performance: Avoid lexing input when not needed in getDOM
Lexing a token can be expensive operation. Perform lexing only if a UUID/ID reference could have been provided.
This commit is contained in:
parent
c3f9d09d22
commit
e7487c8a63
1 changed files with 4 additions and 1 deletions
|
@ -265,7 +265,10 @@ bool getDOM (const std::string& name, const Task& task, Variant& value)
|
|||
Lexer lexer (elements[0]);
|
||||
std::string token;
|
||||
Lexer::Type type;
|
||||
if (lexer.token (token, type))
|
||||
|
||||
// If this can be ID/UUID reference (the name contains '.'),
|
||||
// lex it to figure out. Otherwise don't lex, as lexing can be slow.
|
||||
if ((elements.size() > 1) and lexer.token (token, type))
|
||||
{
|
||||
if (type == Lexer::Type::uuid &&
|
||||
token.length () == elements[0].length ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue