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

Sandro Santilli strk at keybit.net
Thu Feb 21 01:41:36 PST 2013


On Thu, Feb 21, 2013 at 09:22:36AM +0000, Mats Taraldsvik wrote:
> I have now submitted pull requests for bug #310 and increased performance and preallocation on github, ready for review:
> 
> https://github.com/libgeos/libgeos/pull/5
> 
> https://github.com/libgeos/libgeos/pull/4

What's the full url to the branches containing those
commits ? I can't find them from the pull requests.

> Locally, I have modified the WKTWriter::writeNumber(double d) method to use boost::spirit::karma::real_generator for conversion of numbers, instead of std::stringstream. This improves writing WKT by 6x-10x on my datasets (tested with linestrings with up to 10000 points). This change *is not* part of the patch for two reasons:
> 
> - I don't know whether you want to introduce a dependency on boost::spirit::karma, although it is header-only, so it might not be a large barrier.
> 
> - The precision and fixed notation parametres are changed by using policies, essentially structs with static methods that return the precision, trailing_zeros etc. I might be incorrect, but I would have to make policies (structs) for every combination of fixed and decimalPlaces and determine at runtime which of them to use, to make the approach suitable for GEOS. This is easily done, but I don't know if you think it is worth it?

No, I don't think we should introduce a dependency on boost yet.

--strk;


More information about the geos-devel mailing list