Boost logo

Boost Users :

From: Gidi Gal (gidi.gal_at_[hidden])
Date: 2023-11-05 12:32:58


Hello,

Are there any settings or additional code required to optimize the
serialization of std containers ?

I serialize a nested container: std::vector<std::deque<int>>. The max size
of each deque entry is 20. I include boost/serialization/deque.hpp
and boost/serialization/vector.hpp and I serialize the container in the
following way:
std::ofstream ofs(outFileName);
boost::archive::binary_oarchive oa(ofs);
oa << data;

I created data with 10600 integers in the deque. The size of the serialized
output file is 54493.
Now, I test an alternate serialization. I serialized the size of the vector
and then per each entry I serialize its size, which cannot be more than 20,
so char is enough for that, next I serialize the integers in this entry.
The size of the serialized output file is 43484.

Is there a way to achieve better results for the default serialization ?

Thanks,
Gidi



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