Boost logo

Boost Users :

From: Elizabeta Petreska (elizabeta.petreska_at_[hidden])
Date: 2021-07-14 12:29:44


Hi
I upgraded my project to use boost 1.74 instead of boost 1.49. After the
upgrade serialization time for my project archive is extremely slow. With
boost 1.49 my project archive was serialized about 1 to 2 minutes. With
boost 1.74 it takes more than 50 minutes (I stopped the process so I do not
know the exact time it takes) to do the serialization. I am experiencing
this only when doing xml serialization. Binary serialization is good, maybe
just one second difference between 1.49 and 1.74.
What could be the problem with xml serialization ?
Repeatedly stopping and playing the debugger gets me into this function in
the call stack: save_start i.e in save(*) where it saves the name of the
attribute in the xml archive. and then in save_iterator.

basic_xml_oarchive<Archive>::save_start(const char *name)
{
    if(NULL == name)
        return;

    // be sure name has no invalid characters
    std::for_each(name, name + std::strlen(name), detail::XML_name<const
char>());

    end_preamble();
    if(depth > 0){
        this->This()->put('\n');
        indent();
    }
    ++depth;
    this->This()->put('<');
    this->This()->save(name); (*)
    pending_preamble = true;
    indent_next = false;
}

And then save(name) calls this function
template<class InputIterator>
void save_iterator(std::wostream &os, InputIterator begin, InputIterator
end){
    typedef iterators::wchar_from_mb<
        iterators::xml_escape<InputIterator>
> xmbtows;
    std::copy(
        xmbtows(begin),
        xmbtows(end),
        boost::archive::iterators::ostream_iterator<wchar_t>(os)
    );
}



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