Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Boost.serialization vs simple load/save

I am computational scientist that work with large amount of simulation data and often times I find myself saving/loading data into/from the disk. For simple tasks, like a vector, this is usually as simple as dumping bunch of numbers into a file and that's it.

For more complex stuff, life objects and such, I have save/load member functions. Now, I'm not a computer scientist, and thus often times I see terminologies here on SO that I just do not understand (but I love to). One of these that I've came across recently is the subject of serialization and Boost.Serialization library.

From what I understand serialization is the simply the process of converting your objects into something that can be saved/loaded from dist or be transmitted over a network and such. Considering that at most I need to save/load my objects into/from disk, is there any reason I should switch from the simple load/save functions into Boost.Serialization? What would Boost.Serialization give me other than what I'm already doing?

like image 400
mmirzadeh Avatar asked Mar 26 '12 10:03

mmirzadeh


1 Answers

That library takes into accounts many details that could be non very apparent from a purely 'applicative' point of view.

For instance, data portability WRT big/little numeric endianess, pointed data life time, structured containers, versioning, non intrusive extensions, and more. Moreover, it handles the right way the interaction with other std or boost infrastructure, and dictates a way of code structuring that will reward you with easier code maintenance. You will find ready to use serializers for many (all std & boost ?) containers.

And consider if you need to share your data with someone other, there are chances that referring to a published, mantained, and debugged schema will make things much easier.

like image 50
CapelliC Avatar answered Oct 29 '22 06:10

CapelliC