Boost C++ Libraries: Ticket #9116: Binary serialization: bitwise copying should also apply to single POD objects (it now only seems to work on arrays/collections) https://svn.boost.org/trac10/ticket/9116 <p> I'm trying to find the best settings for fast binary serialization of big POD objects. My tests indicate that, for a structure tagged as bitwise serializable, I only get better performance on arrays and vectors, not on individual objects. </p> <p> For instance, say I have a structure made up only of POD types: </p> <pre class="wiki">struct BigStruct { double m1; long long m2; float m3; // ... bool m499; short m500; }; namespace boost { namespace serialization { template &lt;class Archive&gt; void serialize(Archive&amp; ioArchive, BigStruct&amp; ioStruct, const unsigned int iVersion) { ioArchive &amp; ioStruct.m1; ioArchive &amp; ioStruct.m2; ioArchive &amp; ioStruct.m3; // ... ioArchive &amp; ioStruct.m499; ioArchive &amp; ioStruct.m500; } } } #include &lt;boost/serialization/is_bitwise_serializable.hpp&gt; BOOST_IS_BITWISE_SERIALIZABLE(BigStruct); </pre><p> Then, serializing a single BigStruct object takes considerably (at least 5 times) longer than serializing an array of 1 BigStruct object. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9116 Trac 1.4.3 Louis Zanella <louis.zanella@…> Sat, 14 Sep 2013 19:05:49 GMT attachment set https://svn.boost.org/trac10/ticket/9116 https://svn.boost.org/trac10/ticket/9116 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">BigStruct.h</span> </li> </ul> <p> POD structure whose objects should be bitwise serializable </p> Ticket Louis Zanella <louis.zanella@…> Sat, 14 Sep 2013 19:06:28 GMT attachment set https://svn.boost.org/trac10/ticket/9116 https://svn.boost.org/trac10/ticket/9116 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> <p> Program to demonstrate the flaw </p> Ticket Robert Ramey Tue, 01 Oct 2013 12:51:12 GMT <link>https://svn.boost.org/trac10/ticket/9116#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9116#comment:1</guid> <description> <p> basically I like this. But ... what happens to old archives when we change this? Example </p> <p> <em> plane old data struct A { float a; double b; ... }; </em></p> <p> if we serialize this as a block - it'll be faster even though it serializes any empty space due to structure padding. But this will look different than serializing item by item, so this will break compatibility with old archives. This would imply reving the archive format, which I might be willing to do - but that takes more time and risk so I might want to think about it some more. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> </channel> </rss>