I want to serialize a huge amount of data to just able to save and load during running and startup(I do not need any version system, or compatibility during all platforms). So the performance of these jobs are critical for me. After some searches I understood that I must use something like boost-serialize which does not need any precompilation job. After measuring the performance of my code, I got that most parts of my program in doing serialization spend on strcmp
function which is used for type identification.
I have found that we are able to implement our type identification using boost as shown here. But I have two questions about that:
- As I found all type identification implementation needs to override
get_key
function which it returns aconst char*
, so it seems that all type identification must be based onconst char*
and so string comparison still exists which does not seem promising. - I prefer to use for example a
unsigned int
index for each class to identify them during run-time, is there any standard way to do this? Notice that the id assigned to each class must be same in all runs of the program.