I'm deserializing a fair amount of data through Boost.Serialization (one for each frame). However, when I output how long the deserialization takes, it varies wildly. It is not unusably slow at the moment, but it would be nice to make it faster. The data represents the same classes, arrays, maps and vectors but merely with different values.
Looking at the memory spiking as each deserialization takes place, I have to believe there's a better way of doing this than continually allocating and deallocating all this memory.
Here's a few of the read times as an example:
Deserialization - 390 milliseconds
Deserialization - 422 milliseconds
Deserialization - 422 milliseconds
Deserialization - 422 milliseconds
Deserialization - 438 milliseconds
Deserialization - 2156 milliseconds
Deserialization - 1797 milliseconds
Deserialization - 1656 milliseconds
Deserialization - 1328 milliseconds
Deserialization - 1219 milliseconds
Deserialization - 1078 milliseconds
Deserialization - 1078 milliseconds
Is there a way of writing a custom deserialization function for the same data that uses Boost.Serialization so I can specify to allocate the memory at the beginning, and then just change their values for each frame?
Update: I realised a minor issue with the optimization flags I was using was causing the serialization data to be written incorrectly, which resulted in the inconsistency of deserialization times. After fixing this, it is now consistently at 750 - 780 milliseconds each frame.
However, my original question still stands, as currently I am serializing and deserializing an entire stl container, when I really want to only serialize the contents (as the size and indexing of the container will remain exactly the same). I'm not sure of the best way to go about doing this though.