Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Runtime overhead of serialization archives
From: Georg Gast (georg_at_[hidden])
Date: 2016-09-22 15:43:49


Am 22.09.2016 um 08:35 schrieb georg_at_[hidden]:

> I just found out one issue on Windows:
>
> static void to_wire_xml(benchmark::State& state)
> {
> //std::locale::global(std::locale("C"));
>
> while (state.KeepRunning())
> {
> boost_test<boost_xml_trait>::to_wire(ev_test());
> }
> }
>
> If i toggle the commented line, the cost goes down to the half. With the
> Windows profiler i found out, that the construction of the locale takes so
> much time.
>
> Without global set locale:
> Benchmark Time(ns) CPU(ns) Iterations
> ----------------------------------------------
> to_wire_xml 78066 77177 7479
> from_wire_xml 95638 95949 7479
>
> With global set locale:
> 09/22/16 08:32:49
> Benchmark Time(ns) CPU(ns) Iterations
> ----------------------------------------------
> to_wire_xml 41399 41302 16619
> from_wire_xml 52841 52844 11218
>
> Thats amazing! Thats the Level of the Linux implementation.
>
> One riddle is solved :)
>
>

After fiddling around on linux with clang 3.8 and gcc optimizer options
i got down to this. With gcc and -O3.

Benchmark Time(ns) CPU(ns) Iterations
-------------------------------------------------
to_wire_xml 11174 11178 381818
to_wire_text 5148 5149 820313
to_wire_binary 3327 3330 1141304
to_wire_cstyle 63 63 65217391
from_wire_xml 27170 27183 155096
from_wire_text 5371 5370 783582
from_wire_binary 3226 3228 1296296
from_wire_cstyle 45 45 93750000

This results look very nice. <6µs for serilize/deserialize a structure
to a portable text archive seems very nice :)

Now is the difference again pretty big compared to windows .....

-- 
pgp key: 0x702C5BFC
Fingerprint: 267F DC06 7F96 3375 969A  9EE6 8E37 7CF4 702C 5BFC

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