Current implementation requires several O(n) loops:
Writing entities to a main file - O(n)
Adding meta objects to Map - O(n)
Writing meta objects to file - O(m)
Possible improvement could be achieved with one bigger loop, iterating through entities and doing all the operations 1. and 2. while doing so in O(n) time and then saving meta objects to file in O(m) time. This might require implementation of undo/redo logs #6 that would be made beforehand.
All these operations need to be done for both toBeRemoved and toBePersisted, this might be improved too by merging these two maps.
Current implementation requires several
O(n)
loops:O(n)
O(n)
O(m)
Possible improvement could be achieved with one bigger loop, iterating through entities and doing all the operations 1. and 2. while doing so in
O(n)
time and then saving meta objects to file inO(m)
time. This might require implementation of undo/redo logs #6 that would be made beforehand.All these operations need to be done for both
toBeRemoved
andtoBePersisted
, this might be improved too by merging these two maps.