There is a big object as an input in my program and i don't want to initialize it every time. So I have tried the Boost to serialize it(the object is 13.6 MB after serialized). But the performance is not very good. It still need about one minute to load and deserialize it. So I wonder is there any mehtod to make this process faster? I appreaciate any hints or suggestion! thank you in advance
this is the save function:
void mysave(){
dataprepocess dp();//dp is the object i want to save and load
ofstream ofs("dp.dat", ios::binary);
{
boost::archive::binary_oarchive oa(ofs);
// write class instance to archive
oa << dp;
// archive and stream closed when destructors are called
}
cout<<"saving finished"<<endl;
}
here is my load function,
void myload(dataprepocess& dp){
ifstream ifs1("dp_b.dat", ios::binary);
{
boost::archive::binary_iarchive ia1(ifs1);
ia1 >> dp;
}
ifs1.close();
}
I have tried both text_archive and binary_arhive and it prove they don't have much difference in performance.