[OpenLayers-Commits] r5143 - sandbox/ahocevar/sldRenderer/examples
commits at openlayers.org
commits at openlayers.org
Wed Nov 7 12:49:27 EST 2007
Author: ahocevar
Date: 2007-11-07 12:49:26 -0500 (Wed, 07 Nov 2007)
New Revision: 5143
Modified:
sandbox/ahocevar/sldRenderer/examples/profilingAttributeName.html
Log:
added andreas' method 3, which seems to be even better than method 2
Modified: sandbox/ahocevar/sldRenderer/examples/profilingAttributeName.html
===================================================================
--- sandbox/ahocevar/sldRenderer/examples/profilingAttributeName.html 2007-11-07 17:26:42 UTC (rev 5142)
+++ sandbox/ahocevar/sldRenderer/examples/profilingAttributeName.html 2007-11-07 17:49:26 UTC (rev 5143)
@@ -90,6 +90,30 @@
}
console.log("returned value : " + value);
console.timeEnd("andreas' method 2");
+
+
+ console.time("andreas' method 3");
+ var j = 0;
+ while (j < 1000) {
+ var value = initialValue;
+
+ if (typeof value == "string" && value.indexOf("${") != -1) {
+ var attributes = feature.attributes || feature.data;
+ var tokens = value.split("${");
+ for (var i=0; i<tokens.length; i++) {
+ var close = tokens[i].indexOf("}");
+ if (close != -1) {
+ tokens[i] = attributes[tokens[i].substring(0,
+ close)] + tokens[i].substring(++close);
+ }
+ }
+ value = tokens.join("");
+ value = isNaN(value) ? value : parseFloat(value);
+ }
+ j++;
+ }
+ console.log("returned value : " + value);
+ console.timeEnd("andreas' method 3");
}
More information about the Commits
mailing list