With the purpose of the union represented by the figure:
Given the structure below:
TMyRecord = record
Index: Int64;
Kind: TMyEnum;
Value: String;
end
Having two lists ( Generics.Collections.TList<TMyRecord>
) A and B I use the following method to perform the join:
ListA.AddRange(ListB.ToArray);
ListA.TrimExcess;
The problem with this method is that it results in poor performance for lengths over 400 elements per list.
Another requirement would be to maintain the order where after the last element of A must meet the first of B. Such ordering would make it difficult to use parallelism.
So, what are some effective ways of achieving unity by ensuring performance and ordering?