You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lets say you have a list of all the students in a school.
Lots of these students will have the same teacher.
If we serialize the student list and they all have the same teacher reference.. It would make sense to avoid being redundant. However, currently we just write directly to the buffer from front to back. Making some sort of 'reuse' list in the front would require making a new buffer.
We have a few options:
Keep a list of all created instances, and have a specific class 'SerializationReference' that holds an index to this cache of reference that will be resolved on deserialization. What's going to be slow is that we're going to have to 'hash' every single instance being serialized. Then we're going to have to perform a 'lookup' for the majority of deserializations.
Second option
Let the user handle it himself. You could create a serializable class called IdRef<T:iHasId> and each reference can hold an id. In the payload you could include a flat list of students and a flat list of teachers and resolve references as that property is accessed.
Third option
A combination of the above two. All serializable classes that implement iHasId could be 'flattened' then resolved. During deserialization we can store the first instance in typeInstanceTable[id] then check against it for all future instances.
Still thinking will come back to this.
The text was updated successfully, but these errors were encountered:
Lets say you have a list of all the students in a school.
Lots of these students will have the same teacher.
If we serialize the student list and they all have the same teacher reference.. It would make sense to avoid being redundant. However, currently we just write directly to the buffer from front to back. Making some sort of 'reuse' list in the front would require making a new buffer.
We have a few options:
Keep a list of all created instances, and have a specific class 'SerializationReference' that holds an index to this cache of reference that will be resolved on deserialization. What's going to be slow is that we're going to have to 'hash' every single instance being serialized. Then we're going to have to perform a 'lookup' for the majority of deserializations.
Second option
Let the user handle it himself. You could create a serializable class called IdRef<T:iHasId> and each reference can hold an id. In the payload you could include a flat list of students and a flat list of teachers and resolve references as that property is accessed.
Third option
A combination of the above two. All serializable classes that implement iHasId could be 'flattened' then resolved. During deserialization we can store the first instance in typeInstanceTable[id] then check against it for all future instances.
Still thinking will come back to this.
The text was updated successfully, but these errors were encountered: