[ka-Map-users] Re: kaXmlOverlay.js speed improvement
Pg
pg.navone at gmail.com
Sat Jul 8 12:09:33 EDT 2006
First of all I apologize for late response.
I didn't do any test by myself, but I'm surprised of a so big
inefficiency due to the use of single shot loop versus a simple test.
At the moment I think it's not a good idea to apply your solution as
is in the CVS, because the new version will change the behaviour and
will not be backward compatible. I would like to understand where is
the time consuming operation (may be the test on
"ihtml_element.length" instead of testing the array element?) and
write a more efficient loop.
Did you measure the inefficiency in a specific browser or in many
browsers/versions?
2006/6/20, Justin George <justin.george at gmail.com>:
> 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