I'm facing the following situation:
I've a complex simulation model of a type of vehicle. Inside a distributed simulation environment client A updates the model in every cycle. That can be a lot of updates per step for a fast driving, steering, braking, firing, jumping, sliding vehicle object. on the other side, if it just stands still, nearly no updates take place.
a good simulation of course offers the possibility to slide through time. for example you can command it to go back to the last point in time then the speed equals 50 km/h. To implement such a feature excessive state logging is needed.
normally the model controller would log together with updating the model state (position of wheel 1 changed -> log that fact).
In a distributed environment this approach has the drawback that the logging data of all clients has to be consistent. this can become hard if vehicles can be hot-swapped due to last-balancing constraints from client A to B while the simulation runs.
The easier looking approach is to have a single client looking up the shared memory holding the simulation state gathered by all clients and log them every cycle. but because of the high model complexity, this can be a very disc intensive task. fortunately the number of unchanged model data is much higher than the number of changed model data in average, so it would be a lot faster to just log the differences.
For a model with 1000 data entries this means 1000 comparisons to code. Thats nothing for a lazy programmer. My approach for now is to use regular-expressions to transform the data model into the comparison code. Thats easy, but I'm asking myself if C++ maybe offers some elegant technique to do diffs on data structures itself?