Skip to content

miladp55/OList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

OList

A high-performance, memory-optimized list to reduce GC pressure. This class is intended for scenarios where performance and memory allocation are critical. It is not thread-safe by default yet.

The differences from the generic List in .NET are as follows:

Key Differences:

  1. Optimized Memory Management (Array Pooling): Instead of allocating a new array in memory each time the capacity is increased and leaving the old one for the Garbage Collector (GC), we use ArrayPool. This significantly reduces the pressure on the GC, especially in scenarios where lists are frequently created, destroyed, or resized. This is the biggest difference and the main advantage of this class over the standard List.

  2. Use of Span and Memory: For AddRange operations, we use Span. This structure allows us to work directly and very efficiently with a portion of memory, preventing unnecessary data copying.

  3. Implementation of IAsyncEnumerable: For asynchronous iteration, we implement this interface, which allows you to easily iterate over the list using await foreach. This capability is not available in the standard List.

  4. Support for IEnumerable for foreach: For full compatibility with standard foreach loops, we provide an optimized implementation of the IEnumerable and IEnumerator interfaces.

About

A high-performance, memory-optimized list to reduce GC pressure. This class is intended for scenarios where performance and memory allocation are critical. It is not thread-safe by default yet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages