Performance
- Moved DOM stack variable instantiation to immediately before first use, which is after more common use cases.
This commit is contained in:
12
src/DOM.cpp
12
src/DOM.cpp
@@ -162,13 +162,6 @@ const std::string DOM::get (const std::string& name)
|
|||||||
//
|
//
|
||||||
const std::string DOM::get (const std::string& name, const Task& task)
|
const std::string DOM::get (const std::string& name, const Task& task)
|
||||||
{
|
{
|
||||||
Nibbler n (name);
|
|
||||||
n.save ();
|
|
||||||
|
|
||||||
int id;
|
|
||||||
std::string uuid;
|
|
||||||
std::string canonical;
|
|
||||||
|
|
||||||
// <attr>
|
// <attr>
|
||||||
if (task.size () && name == "id")
|
if (task.size () && name == "id")
|
||||||
return format (task.id);
|
return format (task.id);
|
||||||
@@ -176,10 +169,14 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||||||
if (task.size () && name == "urgency")
|
if (task.size () && name == "urgency")
|
||||||
return format (task.urgency_c ());
|
return format (task.urgency_c ());
|
||||||
|
|
||||||
|
std::string canonical;
|
||||||
if (task.size () && context.a3t.canonicalize (canonical, "attribute", name))
|
if (task.size () && context.a3t.canonicalize (canonical, "attribute", name))
|
||||||
return task.get (canonical);
|
return task.get (canonical);
|
||||||
|
|
||||||
// <id>.<name>
|
// <id>.<name>
|
||||||
|
Nibbler n (name);
|
||||||
|
n.save ();
|
||||||
|
int id;
|
||||||
if (n.getInt (id))
|
if (n.getInt (id))
|
||||||
{
|
{
|
||||||
if (n.skip ('.'))
|
if (n.skip ('.'))
|
||||||
@@ -202,6 +199,7 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// <uuid>.<name>
|
// <uuid>.<name>
|
||||||
|
std::string uuid;
|
||||||
if (n.getUUID (uuid))
|
if (n.getUUID (uuid))
|
||||||
{
|
{
|
||||||
if (n.skip ('.'))
|
if (n.skip ('.'))
|
||||||
|
|||||||
Reference in New Issue
Block a user