Boost logo

Boost Users :

Subject: Re: [Boost-users] Fastest way of serializing a huge vector of ints into a human readable string
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-03-01 12:22:28


On Sun, Mar 1, 2009 at 3:36 PM, Roland Bock <rbock_at_[hidden]> wrote:

> Ovanes,
>
> I wonder, though, is there a standard way to write integers to a
> stream_buf? As far as I can see, the ostreambuf_iterator takes character
> classes as template arguments, only.
>
> Regards,
>
> Roland

Roland,

please take a look at this code:
http://codepad.org/UGubU7cw

It it always customized numeric converter is almost always faster as writing
integers to stringstream with operator<<.
Anyway these two tests perform most equally on linux/g++ (but tested very
roughly). For Example on MSVC-compiler std::copy was faster as the for-loop.
I assume compiler can better optimze in this case.

Good Luck,
Ovanes



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net