![]() ![]() In order to leverage this subtree, hashing was implemented. Usually most of the objects in a prefab/scene are unaltered. This speeded up the process significantly. Instead of re-reading the base file support for cloning the base in-memory structure was implemented. Since we needed to do three merges, that meant reading the base file three times so that each could be modified. When applying the merged diff on the base yaml the base is modified as the end result. It speeded up the process, but unfortunately also consumed a bit more memory. The next idea was to pool yaml nodes instead of simply using new/delete all the time. In our case it wasn’t really a string table but a YAMLScalar table, however the idea is the same. If there are a number of duplicates this can save a lot of space. The idea is to simply keep an array of all strings that are present and have each usage point to that string, thereby removing duplicates. It looked very much like a trick that compiler makers have been using forever would fit here: string tables. At that time, realizing that many of the leaf node strings and keys strings in the scene/prefab files are actually the same gave us an idea. Noticing the impact on memory that removing int and float fields had, it seemed to make sense to look in that direction for more memory savings. Those threads could then share the base file structure but read the mine and incoming file in separate threads. By making sure that source structures are also immutable when creating the source diffs it is possible to reuse the source structure for the base and put the creation of the mine/base and incoming/base diffs in two threads.Īn extra threading improvement step was to first read and parse the base file and then at that point make a thread for each of the two diffs. When you have immutability present you have to consider threading since they are a perfect match. Removing float and int from the leaf struct cut memory usage by 40%.īack to improving merge time again. Since the smart merge works on strings most of the time, it makes no sense to keep the former two around. The is not stored as a union but a int,float and string field. The YAML structure replicated the one used inside Unity itself, and it contains a distinction between int,float and string values for leaf nodes in the yaml tree. Now that merge time had been improved, we moved our attention to memory consumption. However, the fact that the source diffs could now be reused for the two other merges more than doubled the speed of the process, and generated a slight decrease in memory usage. With immutability comes the issue of having to copy content from source diffs when creating the merged diff instead of simply referencing. dlang) only logical immutability is used and this works just fine. ![]() Since c++ doesn’t have built in support for immutability (like e.g. ![]() ![]() This was fixed by making the diff structure immutable. Unfortunately, as stated above, the source diffs are rendered invalid when doing a merge and, as such, cannot be reused. Merging cannot be shared since that is where the outcome differs for the three. Much of the setup done by the first can be reused by the next two: Reading and parsing the files, creating mine/base and incoming/base diff. The first glaring issue is that three merges are being done from scratch in the situation where a conflict is present. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |