changeset 2612:49cfa5c66651

Squashed performance bug introduced in rev4070. Now CSV export is about 245 times faster. flys-artifacts/trunk@4195 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 04 Apr 2012 10:32:45 +0000
parents 62e5c6fd2a0c
children 2e129754d450
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 3 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Apr 03 17:32:58 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Apr 04 10:32:45 2012 +0000
@@ -1,3 +1,12 @@
+2012-04-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/WaterlevelExporter.java:
+	  Squashed performance bug introduced in rev4070, which slowed down
+	  CSV export about 245 times!
+
+	* src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java:
+	  Added debug output about savings when joining neighbored nodes.
+
 2012-04-03	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/services/FixingsOverviewService.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java	Tue Apr 03 17:32:58 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java	Wed Apr 04 10:32:45 2012 +0000
@@ -174,6 +174,11 @@
             }
         }
 
+        if (log.isDebugEnabled()) {
+            log.debug("Before/after nodes join: " +
+                N + "/" + nodes.size());
+        }
+
         root = wireTree(nodes);
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Tue Apr 03 17:32:58 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Wed Apr 04 10:32:45 2012 +0000
@@ -466,19 +466,19 @@
 
         long startTime = System.currentTimeMillis();
 
+        String colDesc = !isRange
+            ? FLYSUtils.getNamedMainValue((WINFOArtifact)flys, wqkms.getRawValue())
+            : desc;
+
         for (int i = 0; i < size; i ++) {
             result = wqkms.get(i, result);
 
             if (atGauge) {
-                String tmp = desc;
-                if (!isRange) {
-                    tmp = FLYSUtils.getNamedMainValue((WINFOArtifact)flys, wqkms.getRawValue());
-                }
                 writer.writeNext(new String[] {
                     kmf.format(result[2]),
                     wf.format(result[0]),
                     qf.format(result[1]),
-                    tmp,
+                    colDesc,
                     FLYSUtils.getLocationDescription(flys, result[2]),
                     result[2] >= a && result[2] <= b
                         ? gaugeName

http://dive4elements.wald.intevation.org