[OpenLayers-Dev] VML rendering in IE is slow with big geometries.
Roald de Wit
rdewit at users.sourceforge.net
Tue Oct 16 21:58:17 EDT 2007
Before I create a patch, I'd like to discuss the following issue. We
found out that it takes IE (6 & 7) a long time to draw a linestring
consisting of many coordinates (3000+).
A little investigation in Renderer/VML.js (drawLine) showed that the
biggest slowdown was the concatenation of the 'path' string.
I managed to reduce the time to create the path string dramatically from
40+ seconds to 1 second by mimicking a StringBuffer (put path string
pieces in array and join them in the end).
So, in short, this:
path += " " + x.toFixed() + "," + y.toFixed() + " l ";
is replaced with this:
path.push( " " + x.toFixed() + "," + y.toFixed() + " l ");
The same slowdown most probably applies to the other drawing methods in
My question is: what would be the best way to tackle this?
- create a OpenLayers.Util.StringBuffer object (with append and toString
- create a 'path' object that extends StringBuffer that will be used by
VML.js and possibly SVG.js
I also added a few other optimisations (will put more of that in the
ticket created for this: #1095).
More information about the Dev