From b7d7646c2879a2cfe241c3bc7136a11047ef3624 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 24 May 2014 12:37:43 -0400 Subject: [PATCH] Performance - Moved DOM stack variable instantiation to immediately before first use, which is after more common use cases. --- src/DOM.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/DOM.cpp b/src/DOM.cpp index 8cbe5fa0c..0b365cbc8 100644 --- a/src/DOM.cpp +++ b/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) { - Nibbler n (name); - n.save (); - - int id; - std::string uuid; - std::string canonical; - // if (task.size () && name == "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") return format (task.urgency_c ()); + std::string canonical; if (task.size () && context.a3t.canonicalize (canonical, "attribute", name)) return task.get (canonical); // . + Nibbler n (name); + n.save (); + int id; if (n.getInt (id)) { if (n.skip ('.')) @@ -202,6 +199,7 @@ const std::string DOM::get (const std::string& name, const Task& task) } // . + std::string uuid; if (n.getUUID (uuid)) { if (n.skip ('.'))