$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Matthias Troyer (troyer_at_[hidden])
Date: 2008-08-04 10:59:07
On Aug 4, 2008, at 4:20 PM, Sebastian.Karlsson_at_[hidden] wrote:
>
>>> 1) In the overview section performance is nowhere to be seen as a   
>>> goal, which for my use case is very important. If I were to use  
>>> the  binary archive, how well would it perform in comparsion to a  
>>> hand  crafted optimized serialization aproach? I've seen in the  
>>> examples  that strings seems to be used to identify data, won't  
>>> this create a  large overhead for both deserilzation and storage?
>>
>> Performance is a secondary goal that I have worked on, especially the
>> serialization of large dense arrays. This is now as fast ad any hand
>> crafted approach. What data structures are you interested in?
>>
>> Matthias
>
> I'm reading a xml file into a custom tree data structure, parsing  
> the string representations into their correct types stored as  
> boost::any. I'm hoping that deserialization using boost::serialize  
> will be considerably faster than using libxml2 which I use to parse  
> the xml file. The node data in this structure pretty much looks like:
>
> vector< DataCollection > children; // Naturally all the children of  
> this node
> std::string name; // This is the tag name in xml
> boost::any value; // This is <b>value</b> in xml
> std::map< std::string, boost::any > attributes; // Not entirely  
> suprising the attributes of the xml node
>
> The values stored in boost::any will be fairly lightweight, so I  
> would recon that the majority of data read will actually be  
> std::string for keys into the attributes as well as the name of the  
> node. So I guess I'm having a little bit of everything hehe.
>
> Since I won't send this data over network, and if I make a build for  
> another system I can just ship different data files, I'm more  
> interested in speed and the flexibility which boost::serilization  
> offers. I'd be very interested in your changes Matthias.
There are not many optimizations for XML files: most of the overhead  
is in parsing the strings. I you are interested in performance, a  
binary archive will always be faster than an XML one. Most of the  
optimizations for binary archives are already in Boost 1.35.
I have a couple of questions:
1. why are your attributes a std::map< std::string, boost::any >  and  
not a std::map< std::string, std::string > ? How do you find out which  
type to use?
2. why is your value a boost::any? How do you know the type to use?
Matthias