Generics.Collections – TList / TListHelper grows list size too aggressively
The current code will double the size of the list, regardless of it’s current size. This is fine for smaller sizes – but very wasteful when growing a large list.
Due to the design having ListHelper as a record which have an instance inside the class – it is not possible to simply make ListHelper.InternalGrow method virtual.
I am not sure what will be the better way to do this. Calling a plugin method (anonymous function) might be too costly and slow down the list at smaller sizes.
Perhaps have a growth strategy setting: Exponential (default), Percentage, Linear – and a growth factor field – which would be the percentage or number of items, depending on the strategy?
Anyways – just doubling a 128K, 256K, 512K, 1M list is not a good strategy – at least not if you are not able to override it.