# HG changeset patch # User Sascha L. Teichmann # Date 1320055268 0 # Node ID ae6ace900c0716d841feb98f2fd68dddab543714 # Parent fe7f9264a2edb56311076f27771f501c2e48ad49 Small loop optimization flys-artifacts/trunk@3119 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r fe7f9264a2ed -r ae6ace900c07 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Sun Oct 30 19:28:59 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Oct 31 10:01:08 2011 +0000 @@ -1,3 +1,8 @@ +2011-10-31 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java: + Do not call size() in for loop again and again. + 2011-10-30 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/geom/Polygon2D.java: diff -r fe7f9264a2ed -r ae6ace900c07 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java Sun Oct 30 19:28:59 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java Mon Oct 31 10:01:08 2011 +0000 @@ -103,7 +103,10 @@ * @return according WKms. */ public static WKms getWKmsUncached(int column, int wst_id) { - log.debug("WKmsFactory.getWKmsUncached c/" + column + ", wst_id/" + wst_id); + + if (log.isDebugEnabled()) { + log.debug("WKmsFactory.getWKmsUncached c/" + column + ", wst_id/" + wst_id); + } WKmsImpl wkms = new WKmsImpl(getWKmsName(column, wst_id)); @@ -121,7 +124,7 @@ int lastColumn = Integer.MAX_VALUE; - for (int i = 0; i < results.size(); i++) { + for (int i = 0, N = results.size(); i < N; i++) { Object[] row = results.get(i); wkms.add((Double) row[0], (Double) row[1]); }