Steven Giesel 9/7/2023

Enabling List<T> to store large amounts of elements

Read Original

This technical article discusses a performance limitation of the standard .NET List<T> when storing very large numbers of elements, as it can land on the non-compacted Large Object Heap (LOH). It proposes and provides a simplified C# implementation of a 'ChunkedList<T>' that uses an array of arrays (jagged array) to keep individual chunks small, similar to StringBuilder's strategy, thereby avoiding LOH fragmentation and performance degradation.

Enabling List<T> to store large amounts of elements

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser