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

Mateusz Loskot mateusz at loskot.net
Thu Feb 21 03:42:58 PST 2013


On 21 February 2013 09:41, Sandro Santilli <strk at keybit.net> wrote:
> On Thu, Feb 21, 2013 at 09:22:36AM +0000, Mats Taraldsvik wrote:
>
>> 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.

Any chance to at least conditionally-compile for C++11 and use

http://en.cppreference.com/w/cpp/string/basic_string/stof

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net


More information about the geos-devel mailing list