lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [4844] Refactor, removing the speed penalty introduced 201


From: Greg Chicares
Subject: [lmi-commits] [4844] Refactor, removing the speed penalty introduced 20100417T1245Z
Date: Mon, 19 Apr 2010 22:30:52 +0000

Revision: 4844
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4844
Author:   chicares
Date:     2010-04-19 22:30:51 +0000 (Mon, 19 Apr 2010)
Log Message:
-----------
Refactor, removing the speed penalty introduced 20100417T1245Z

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/product_data.cpp
    lmi/trunk/product_data.hpp
    lmi/trunk/xml_serializable.hpp
    lmi/trunk/xml_serializable.tpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-04-19 20:44:46 UTC (rev 4843)
+++ lmi/trunk/ChangeLog 2010-04-19 22:30:51 UTC (rev 4844)
@@ -24908,3 +24908,22 @@
   workhorse.make
 Permit annotations in '.policy' files.
 
+20100419T2044Z <address@hidden> [760]
+
+  input.hpp
+  input_xml_io.cpp
+  product_data.cpp
+  product_data.hpp
+  xml_serializable.hpp
+  xml_serializable.tpp
+Refactor, simplifying the xml_serializable API.
+
+20100419T2230Z <address@hidden> [760]
+
+  product_data.cpp
+  product_data.hpp
+  xml_serializable.hpp
+  xml_serializable.tpp
+Refactor, removing the speed penalty introduced 20100417T1245Z. See:
+  http://lists.nongnu.org/archive/html/lmi/2010-04/msg00025.html
+

Modified: lmi/trunk/product_data.cpp
===================================================================
--- lmi/trunk/product_data.cpp  2010-04-19 20:44:46 UTC (rev 4843)
+++ lmi/trunk/product_data.cpp  2010-04-19 22:30:51 UTC (rev 4844)
@@ -297,13 +297,13 @@
 /// strings, and strings can legitimately contain anything.
 
 void product_data::read_element
-    (xml::element const& parent
+    (xml::element const& e
     ,std::string const&  name
     ,int                 // file_version
     )
 {
     glossed_string& r = *member_cast<glossed_string>(operator[](name));
-    xml_serialize::get_element(parent, name, r);
+    xml_serialize::from_xml(e, r);
 }
 
 void product_data::write_element

Modified: lmi/trunk/product_data.hpp
===================================================================
--- lmi/trunk/product_data.hpp  2010-04-19 20:44:46 UTC (rev 4843)
+++ lmi/trunk/product_data.hpp  2010-04-19 22:30:51 UTC (rev 4844)
@@ -105,7 +105,7 @@
 
     // xml_serializable overrides.
     virtual void read_element
-        (xml::element const& parent
+        (xml::element const& e
         ,std::string const&  name
         ,int                 file_version
         );

Modified: lmi/trunk/xml_serializable.hpp
===================================================================
--- lmi/trunk/xml_serializable.hpp      2010-04-19 20:44:46 UTC (rev 4843)
+++ lmi/trunk/xml_serializable.hpp      2010-04-19 22:30:51 UTC (rev 4844)
@@ -63,7 +63,7 @@
 
     // Reading and writing.
     virtual void read_element
-        (xml::element const& parent
+        (xml::element const& e
         ,std::string const&  name
         ,int                 file_version
         );

Modified: lmi/trunk/xml_serializable.tpp
===================================================================
--- lmi/trunk/xml_serializable.tpp      2010-04-19 20:44:46 UTC (rev 4843)
+++ lmi/trunk/xml_serializable.tpp      2010-04-19 22:30:51 UTC (rev 4844)
@@ -138,7 +138,7 @@
             );
         if(residuary_names.end() != current_member)
             {
-            read_element(x, node_tag, file_version);
+            read_element(*child, node_tag, file_version);
             residuary_names.erase(current_member);
             }
         else if(is_detritus(node_tag))
@@ -228,25 +228,22 @@
 /// types (for which any_member<T>::operator=(std::string const&) is
 /// valid). Override it wherever that precondition does not hold.
 ///
-/// xml_serialize::get_element() does nearly the same thing, but in a
+/// xml_serialize::from_xml() does nearly the same thing, but in a
 /// type-dependent way; thus, it doesn't have the precondition above.
 /// However, the datum here has been subject to type erasure and its
 /// type is not readily unerased.
 ///
-/// Calling retrieve_element() here imposes a speed penalty of
-/// seventeen percent (measured with the 'input_test' unit test), and
-/// is superfluous because the element is already available through
-/// an iterator in read().
+/// The xml::element argument is the element to be read, which is
+/// already available through an iterator in read().
 
 template<typename T>
 void xml_serializable<T>::read_element
-    (xml::element const& parent
+    (xml::element const& e
     ,std::string const&  name
     ,int                 file_version
     )
 {
-    xml::node::const_iterator i = xml_lmi::retrieve_element(parent, name);
-    std::string s = xml_lmi::get_content(*i);
+    std::string s = xml_lmi::get_content(e);
     redintegrate_ex_ante(file_version, name, s);
     t()[name] = s;
 }
@@ -263,6 +260,9 @@
 /// of fourteen percent (measured with the 'input_test' unit test),
 /// yet would serve no purpose because immit_members_into() iterates
 /// across std::map keys, which are guaranteed to be unique.
+///
+/// The xml::element argument is the parent of the element to be
+/// written.
 
 template<typename T>
 void xml_serializable<T>::write_element





reply via email to

[Prev in Thread] Current Thread [Next in Thread]