ICapacityVector

Description

interface Tinman.Core.Collections.ICapacityVector

Derived from

ICapacity

Extended by

ArrayDeque sealed
ArrayVector sealed

Base interface for vector-like collections that have an internal storage capacity that will grow as required.

The methods and properties of this interface may be used to achieve optimal capacity values for collections, to avoid unnecessary growing of the internal storage or wasted memory because of unnecessarily big storage capacities. The result of their use should be validated with a memory profiler tool, to avoid potential harmful optimization attempts.

Public / Methods

Capacity​Ensure


public method CapacityEnsure → (1)

capacity in : int32

The minimum storage capacity size.

Ensures that the internal storage capacity has a minimum size.

Using this method can reduce the number of times the internal storage needs to grow.

Capacity​Trim


public method CapacityTrim → ()

Trims the capacity of the internal storage to the current size of the collection.

Using this method can reduce the memory consumption at runtime by eliminating the memory that is wasted because the capacity is greater than the collection size.

Public / Attributes

Capacity​Grow


public attribute CapacityGrow → (get)

value : int32

[>=0]
the number of times the internal storage has grown.

Returns the number of times the internal storage has grown.

To reduce the grow count, use a bigger initial capacity or CapacityEnsure.