Hi,
I have the feeling that appendToDocumentList is correct when we have not a lot of records in arrays. But if the array exceed about several thousands records, performance are not good. (I don’t speach about memories on the server, I don’t forget that in my mind) I thinks there is kind of sort algorithm inside the service and this one is not really optimized.
Am I wrong and if yes, how to accumulate lot of records in a same arrays.
I have in my mind some bulkinsert instruction, so I don’t want to not use a array.
Growing an array means that new arrays are allocated frequently and the contents is copied from the old to the new one. Modern JVMs hsould be good at this. But if it still is a problem then there are services that work with java collections. This is usually faster that working with arrays. In the end, you still have to convert that to an array because nearly all wM services expect arrays and to java collections.
IMO, the numbers just have to be large enough, then you’ll start to have problems even with collections. In that case you should rethink your solution.