Re: [Boost-bugs] [Boost C++ Libraries] #4307: basic_oarchive optimization

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4307: basic_oarchive optimization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-06 23:40:07


#4307: basic_oarchive optimization
--------------------------+-------------------------------------------------
 Reporter: anonymous | Owner: ramey
     Type: Patches | Status: new
Milestone: Boost 1.43.0 | Component: serialization
  Version: Boost 1.44.0 | Severity: Optimization
 Keywords: |
--------------------------+-------------------------------------------------

Comment(by anonymous):

 b) thread synchronization: that's the same compromise the code marked with
 TODO makes, it only modifies data before main() - TODO can be removed.

 c) basic_iarchive: haven't looked at it in detail, but yes. will provide
 patch as soon as we've figured out what parts of this patch can make it
 into boost.

 d) I don't know the status of AutoBuffer. the supplied
 archive::detail::auto_buffer only implements a small part of it. I'd
 rather keep this an implementation detail. fully implementing and
 documenting it would duplicate Boost.Autobuffer.

 e) tests: yep

 f) performance test: likewise

 g) class_id/object_id in sequence: I don't make the assumption that
 class_id is allocated in sequence, I assume that it is ok that they are
 NOT in sequence.
 so while the unpatched basic_oarchive might have procudec an output like

 <class id="1">...</class><class id="2">...</class>

 the patched one might produce

 <class id="43">...</class><class id="25">...</class>

 wrt your concern about std::set:
 a std::set/std::map is indeed necessary, I've only changed the point of
 construction of this map.
 previously, when a class was serialized it was added to the map.
 patched, every class for which serialization is instantiated is assigned a
 type_id before main(), which is then used to index a vector.

 before:
 class A{}; class B{}; class C{};

 int main(){
   ar << c; //assigns class id 1 to C

   ar << a; //assigns class id 2 to A
 }

 after:

 class A{}; class B{}; class C{};

 before main:
 assign class id 1 to A, 2 to B, 3 to C

 int main(){
   ar << c; //serializes c with class id 3

   ar << a; //serializes a with class id 1
 }

 the downside of this:
 if serialization is instantiated for say 10000 classes, and then an
 archive is used to serialize exactly one object whose type happens to have
 been assign type_id 9999, a vector<cobject> with size 10000 is
 initialized.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4307#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC