[gxml] Improved performance tests
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Improved performance tests
- Date: Tue, 15 Mar 2016 19:56:09 +0000 (UTC)
commit 7031c1244644a6c703069e332680b8bc3f4f2da3
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Mar 10 12:53:00 2016 -0600
Improved performance tests
test/gxml-performance.vala | 73 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 66 insertions(+), 7 deletions(-)
---
diff --git a/test/gxml-performance.vala b/test/gxml-performance.vala
index 405ff39..0f85a5e 100644
--- a/test/gxml-performance.vala
+++ b/test/gxml-performance.vala
@@ -335,17 +335,72 @@ public class Performance
Test.timer_start ();
var d = new GDocument.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.minimized_result (time, "GDocument open document from path: %g seconds", time);
+ Test.message ("Starting Deserializing...");
+ for (int i = 0; i < 1000000; i++);
Test.timer_start ();
var bs = new BookStore ();
bs.deserialize (d);
time = Test.timer_elapsed ();
- Test.minimized_result (time, "deserialize/performance: %g seconds", time);
+ Test.minimized_result (time, "GDocument deserialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
Test.timer_start ();
var d2 = new GDocument ();
bs.serialize (d2);
time = Test.timer_elapsed ();
- Test.minimized_result (time, "serialize/performance: %g seconds", time);
+ Test.minimized_result (time, "GDocument serialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
+ Test.timer_start ();
+ var nf = GLib.File.new_for_path (GXmlTest.get_test_dir () + "/test-large-tw.xml");
+ d2.indent = true;
+ d2.save_as (nf);
+ time = Test.timer_elapsed ();
+ Test.minimized_result (time, "GDocument Write to disk serialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
+ assert (nf.query_exists ());
+ nf.delete ();
+ } catch (GLib.Error e) {
+#if DEBUG
+ GLib.message ("ERROR: "+e.message);
+#endif
+ assert_not_reached ();
+ }
+ });
+
+ Test.add_func ("/gxml/performance/serialize/gdocument/read_doc",
+ () => {
+ try {
+ double time;
+ Test.timer_start ();
+ GLib.File f = GLib.File.new_for_path (GXmlTest.get_test_dir () + "/test-large.xml");
+ assert (f.query_exists ());
+ var d = new GDocument ();
+ TDocument.read_doc (d, f, null);
+ time = Test.timer_elapsed ();
+ Test.minimized_result (time, "GDocument open document from path: %g seconds", time);
+ Test.message ("Starting Deserializing...");
+ for (int i = 0; i < 1000000; i++);
+ Test.timer_start ();
+ var bs = new BookStore ();
+ bs.deserialize (d);
+ time = Test.timer_elapsed ();
+ Test.minimized_result (time, "GDocument deserialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
+ Test.timer_start ();
+ var d2 = new GDocument ();
+ bs.serialize (d2);
+ time = Test.timer_elapsed ();
+ Test.minimized_result (time, "GDocument serialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
+ Test.timer_start ();
+ var nf = GLib.File.new_for_path (GXmlTest.get_test_dir () + "/test-large-tw.xml");
+ d2.indent = true;
+ d2.save_as (nf);
+ time = Test.timer_elapsed ();
+ Test.minimized_result (time, "GDocument Write to disk serialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
+ assert (nf.query_exists ());
+ nf.delete ();
} catch (GLib.Error e) {
#if DEBUG
GLib.message ("ERROR: "+e.message);
@@ -360,26 +415,30 @@ public class Performance
Test.timer_start ();
var d = new TDocument.for_path (GXmlTest.get_test_dir () + "/test-large.xml");
time = Test.timer_elapsed ();
- Test.minimized_result (time, "open document from path: %g seconds", time);
- for (int i = 0; i < 100000; i++);
+ Test.minimized_result (time, "TDocument open document from path: %g seconds", time);
+ Test.message ("Starting Deserializing...");
+ for (int i = 0; i < 1000000; i++);
Test.timer_start ();
var bs = new BookStore ();
bs.deserialize (d);
time = Test.timer_elapsed ();
Test.minimized_result (time, "TDocument deserialize performance: %g seconds", time);
- for (int i = 0; i < 100000; i++);
+ for (int i = 0; i < 1000000; i++);
Test.timer_start ();
var d2 = new TDocument ();
bs.serialize (d2);
time = Test.timer_elapsed ();
Test.minimized_result (time, "TDocument serialize performance: %g seconds", time);
- for (int i = 0; i < 100000; i++);
+ for (int i = 0; i < 1000000; i++);
Test.timer_start ();
var nf = GLib.File.new_for_path (GXmlTest.get_test_dir () + "/test-large-tw.xml");
d2.indent = true;
d2.save_as (nf);
time = Test.timer_elapsed ();
Test.minimized_result (time, "TDocument Write to disk serialize/performance: %g seconds", time);
+ for (int i = 0; i < 1000000; i++);
+ assert (nf.query_exists ());
+ nf.delete ();
} catch (GLib.Error e) {
#if DEBUG
GLib.message ("ERROR: "+e.message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]