Skip to main content

SharedPools

Shared object pool for roslyn

Use this shared pool if only concern is reducing object allocations. if perf of an object pool itself is also a concern, use ObjectPool directly.

For example, if you want to create a million of small objects within a second, use the ObjectPool directly. it should have much less overhead than using this.

Assembly: ServiceStack.Text.dll
View Source
Declaration
public static class SharedPools

Fields

StringIgnoreCaseHashSet

pool that uses string as element with StringComparer.OrdinalIgnoreCase as element comparer

View Source
Declaration
public static readonly ObjectPool<HashSet<string>> StringIgnoreCaseHashSet

StringHashSet

pool that uses string as element with StringComparer.Ordinal as element comparer

View Source
Declaration
public static readonly ObjectPool<HashSet<string>> StringHashSet

ByteArray

Used to reduce the # of temporary byte[]s created to satisfy serialization and other I/O requests

View Source
Declaration
public static readonly ObjectPool<byte[]> ByteArray

ByteBufferSize

View Source
Declaration
public const int ByteBufferSize = 4096

AsyncByteArray

View Source
Declaration
public static readonly ObjectPool<byte[]> AsyncByteArray

Methods

BigDefault<T>()

pool that uses default constructor with 100 elements pooled

View Source
Declaration
public static ObjectPool<T> BigDefault<T>()
where T : class, new()
Returns

ServiceStack.Text.Pools.ObjectPool<T>

Type Parameters
  • T

Default<T>()

pool that uses default constructor with 20 elements pooled

View Source
Declaration
public static ObjectPool<T> Default<T>()
where T : class, new()
Returns

ServiceStack.Text.Pools.ObjectPool<T>

Type Parameters
  • T

StringIgnoreCaseDictionary<T>()

pool that uses string as key with StringComparer.OrdinalIgnoreCase as key comparer

View Source
Declaration
public static ObjectPool<Dictionary<string, T>> StringIgnoreCaseDictionary<T>()
Returns

ServiceStack.Text.Pools.ObjectPool<T>

Type Parameters
  • T