[gxml] Added performance tests for deserialize large files.



commit ac9f4969dd07457de1d7b65ab05f613053d71acc
Author: Daniel Espinosa <esodan gmail com>
Date:   Sun Aug 10 20:42:43 2014 -0500

    Added performance tests for deserialize large files.

 configure.ac               |    7 +++++++
 gxml/Makefile.am           |   10 +++++++++-
 test/gxml-performance.vala |   14 ++++++++++----
 3 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 87656f7..4309183 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,6 +148,13 @@ if test x$enable_docs = xyes; then
 fi
 AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes])
 
+debug=no
+AC_ARG_ENABLE(debug,
+       AS_HELP_STRING([--enable-debug], [Enable Debug options [default=no]]),
+        [debug=$enableval], [debug="no"])
+
+AM_CONDITIONAL(DEBUG, [test $debug = yes])
+
 if test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"; then
   AC_MSG_ERROR([Doc building requested for valadoc but not installed.])
 fi
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index b8b9665..e5de0fa 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -3,6 +3,7 @@
 # Empty variable to be added elements later
 CLEANFILES=
 BUILT_SOURCES=
+AM_VALAFLAGS=
 
 ### Library
 
@@ -68,9 +69,16 @@ AM_CFLAGS = \
 
 # -Wall   # TODO: add this back when we can properly handle more libxml2/vala warnings
 
+if DEBUG
+  AM_VALAFLAGS += \
+    -D DEBUG \
+    --enable-mem-profiler \
+    -g
+endif
+
 
 # library flags
-AM_VALAFLAGS = \
+AM_VALAFLAGS += \
        $(ERROR_VALAFLAGS) \
        --library=gxml-0.4 \
        $(top_srcdir)/vapi/config.vapi \
diff --git a/test/gxml-performance.vala b/test/gxml-performance.vala
index 5bc143b..61d8308 100644
--- a/test/gxml-performance.vala
+++ b/test/gxml-performance.vala
@@ -78,23 +78,29 @@ public class Performance
     Test.add_func ("/gxml/performance/document", 
     () => {
       Test.timer_start ();
+      double time;
       var d = new Document.from_path (GXmlTest.get_test_dir () + "/test-large.xml");
+      time = Test.timer_elapsed ();
+      Test.minimized_result (time, "Load large document: %g seconds", time);
+      Test.timer_start ();
       foreach (GXml.Node n in ((GXml.Node)d.document_element).child_nodes) {
         if (n.node_name == "Book1") { /* Fake just to access the node */ }
       }
-      double time;
       time = Test.timer_elapsed ();
-      Test.minimized_result (time, "serialize/performance: %g s", time);
+      Test.minimized_result (time, "Itirate over all loaded nodes: %g seconds", time);
     });
     Test.add_func ("/gxml/performance/deserialize", 
     () => {
+      double time;
       Test.timer_start ();
       var d = new Document.from_path (GXmlTest.get_test_dir () + "/test-large.xml");
+      time = Test.timer_elapsed ();
+      Test.minimized_result (time, "open document from path: %g seconds", time);
+      Test.timer_start ();
       var bs = new BookStore ();
       bs.deserialize (d);
-      double time;
       time = Test.timer_elapsed ();
-      Test.minimized_result (time, "serialize/performance: %g s", time);
+      Test.minimized_result (time, "serialize/performance: %g seconds", time);
     });
   }
 }


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