[geos-devel] Ability to preallocate the WKT stringstream buffer for really large geometries?

Mats Taraldsvik mats.taraldsvik at norkart.no
Fri Jan 18 03:52:41 PST 2013


Generally, I'm very satisfied with the WKTWriter, which is really easy to use, and converts the Geometries to the WKT format. However, when converting _large_ geometries (in this case, contour lines), I get a major decrease in performance.

By looking at the source code (and profiling), I believe the use of a stringstream and hence a dynamically increasing string buffer, constantly reallocating, is causing the performance penalty. Possibly also copying the large string.

Is there anything I can do to improve this scenario? Do you accept contributions to fix this (e.g. passing in the expected size of the resulting WKT string)?


Mats Taraldsvik
mats.taraldsvik at norkart.no

Løkketangen 20A
Postboks 145
N- 1300 Sandvika
+47 67 55 14 00

More information about the geos-devel mailing list