Subject: Re: [boost] How do folks test serialization code?
From: John Maddock (john_at_[hidden])
Date: 2013-08-06 04:06:38
>> You mean rely on the usual streaming << >> operators?
>> For sure I could do that, but full string conversion is crazy
>> expensive compared to the byte-by-byte scheme I have now.
> Hmm - I presume you've already had to implement these
> operators. So you'd be done for text based archives like
> text_archve and xml_archive. For these cases, I wouldn't
> worry about the expense as these archives are already
> slow enough due to all the streaming conversions they
> do already, I doubt anyone would notice - oh and don't
> forget about xml parsing. So for these archive classes:
> a) performance isn't really an issue.
I hear you, but it's not quite that simple: multiprecision binary-decimal
conversion is a whole minefield:
* The code is terminally slow, way more than for native types.
* To do it correctly for floats you need an arbitrarily large precision for
the intermediate calculations in the worst case (albeit doesn't happen
* Many libraries don't do it right anyway, so for example with mpf_t you
can't round trip to and from string representations... of course that's
sadly true of double on some platforms (msvc) as well :-(
> b) it's helpful to be able to read floats/double, etc as
> human readable strings.
Can't argue with that one ;-)
> c) it consumes no extra development time. - it's free!
> I'm thinking the only place where making special
> overload would make sense would be for portable
> binary archive - which as far as I know doesn't
> currently support floating point types in any case.
> Hmmm - maybe you want to generalize your
> method to any size float/double and include it
> as part of portable binary archive? That would
> be great!
LOL :) Not just yet, sorry!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk