[ka-Map-users] kaXmlOverlay.js speed improvement

Justin George justin.george at gmail.com
Tue Jun 20 17:06:29 EDT 2006


Pg, thanks again for your work on the client-side overlays. I have a
small patch that might help with speed for rendering lots of ihtml
elements.

Since they are replacing the value of the inner HTML right now,
replacing the loop with an 'if' statement has sped things up for me
(rendering approximately 50 points per call) by about ten times.

This might also be considered for other types of points, but I'm not
sure how many people are using within a single point, so I wouldn't
want to unroll the loops for them without being sure that people were
using small numbers.

In kaXmlOverlay.js, object kaXmlPoint, function parse:
replace the
for(i=0; i<ihtml_element.length; i++) {

with

if(ihtml_element[0]) {


Or, in unified diff from subversion:

@@ -1390,8 +1390,9 @@

 	// look for ihtml element
 	var ihtml_element = point_element.getElementsByTagName("ihtml");
-	for (i=0; i<ihtml_element.length; i++) {
-		this.div.innerHTML = ihtml_element[i].firstChild.nodeValue;
+	
+	if(ihtml_element[0]) {
+		this.div.innerHTML = ihtml_element[0].firstChild.nodeValue;

Thanks again,
J


More information about the ka-Map-users mailing list