Boost logo

Boost Users :

From: Bill Lear (rael_at_[hidden])
Date: 2006-06-05 12:41:47


It could be that I'm being foolish, or that there is something very
strange going on in how the Boost serialization library interacts with
the Intel C++ compiler that I don't understand. I'll post a short
question first, eliding underlying motivations, to see if this
warrants further discussion.

I am running on 64-bit Linux, using the Intel C++ compiler, version
9.0, and gcc 3.4.5.

I have a large, complex data structure that I am serializing. All
serialize methods use the BOOST_SERIALIZATION_NVP macro. The data
structure serializes and deserializes accurately for each of text,
xml, and binary archives. The size on disk is about 250 megabytes,
using the binary archives.

The load method I use is roughly this:

#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
//#include <boost/archive/text_oarchive.hpp>
//#include <boost/archive/text_iarchive.hpp>
//#include <boost/archive/xml_oarchive.hpp>
//#include <boost/archive/xml_iarchive.hpp>

#include "Foo.hh"

Foo* load(const string& filename) {
    istream ifs(filename.c_str(), ios::binary);

    Foo* foo = 0;

    boost::archive::binary_iarchive ia(ifs);
    ia >> BOOST_SERIALIZATION_NVP(foo);

    return foo;
}

Above this method, note the commented-out text and xml archive
headers.

Here is the strange part: When using the Intel compiler, and run with
the text and xml archive headers commented out, the load method takes
about 9.6 seconds. When I uncomment the text and xml headers, the
load time almost doubles, to 18.8 seconds or so. I do not see
this with gcc.

So the question is: have I done something foolish here, or is this
wacky?

I am using the following command to compile the code:

% icpc -O2 -Ob2 -ip <...>

Any help appreciated.

Bill


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