Mercurial > dive4elements > river
changeset 1796:ae6ace900c07
Small loop optimization
flys-artifacts/trunk@3119 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 31 Oct 2011 10:01:08 +0000 |
parents | fe7f9264a2ed |
children | 5eec623db50a |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java |
diffstat | 2 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sascha.teichmann@intevation.de> + + * 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 <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/geom/Polygon2D.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]); }