Does serializing a binary sequence stored in vector cost much? For example if I am using binary archive. Will the boost::serialization library put characters to differentiate char elements of vector and make the output larger?
Asked
Active
Viewed 659 times
1
1 Answers
0
Measure it!
The sort answers:
- No it doesn't cost much. Profile it (and see whether it fits your application)
- No, vector elements will not be differentiated for vectors of POD types.
(Things change when you serialize vectors containing pointers to polymorphic classes. This is obvious, since it couldn't be done more efficiently unless you have extra knowledge about the particular dataset)
The storage cost:
Longer answers:
Boost C++ Serialization overhead (comparative storage efficiency of different archives, with and without compression)
Boost Serialization Binary Archive giving incorrect output (on why some types take more than the potential bare minimum, e.g. on 64bit systems)
Tune things
boost::archive::no_header
The runtime cost:
how to do performance test using the boost library for a custom library
Tune things
boost::archive::no_codecvt