I have a very big nested object(stringify comes 4mb) similar as following which can be 15-20 level deep:
{
"a": 5,
"b": {
"0": 1,
"1": "x",
"length": 2
},
"x": {
"a": 1,
"1": "z"
},
"c": {
"0": 3,
"1": "Am",
"3": {
"0": 3,
"1": "x",
"2": {
"0": 3,
"1": "Y",
"length": 2
},
"length": 3
},
"length": 4
}
}
After every action on page some property of object gets changed don't know what e.g. above becomes following(see c["3"]["2"]):
{
"a": 5,
"b": {
"0": 1,
"1": "x",
"length": 2
},
"x": {
"a": 1,
"1": "z"
},
"c": {
"0": 3,
"1": "Am",
"3": {
"0": 3,
"1": "x",
"2": {z:5,n:"y"},
"length": 3
},
"length": 4
}
}
I can't store whole object every time as it will overflow the memory. So I want to keep track of changes only. So when replaying the action I'll just change that part of object and it will show new object.
Note: I don't want to go with comparison of object in iterative way as that computation will also cost me much as object size is very high.
I'm not getting any heads up how to start on it.
I think some way hashing object properties should help(just like angularJS does in its digest cycle).