Table of Contents

Struct CsvParallelOptions

Namespace
FlameCsv
Assembly
FlameCsv.Core.dll

Options for parallel CSV processing.

public readonly record struct CsvParallelOptions : IEquatable<CsvParallelOptions>
Implements

Fields

DefaultChunkSize

The default chunk size (record count) for reading or writing in parallel.

public const int DefaultChunkSize = 128

Field Value

int

Properties

CancellationToken

Token to cancel the read or write operation.

public CancellationToken CancellationToken { get; init; }

Property Value

CancellationToken

ChunkSize

Size of chunks to use when processing data in parallel.
When reading CSV, this many records are parsed before they are yielded to the consumer.
When writing CSV, the batch size for records to write in parallel.

public int? ChunkSize { get; init; }

Property Value

int?

MaxDegreeOfParallelism

Maximum degree of parallelism to use. This value (or -1 for if null) is passed to TPL methods.

public int? MaxDegreeOfParallelism { get; init; }

Property Value

int?

Remarks

This value controls how many producers (IMaterializer<T, TResult> or IDematerializer<T, TValue>) can be active at any given time.

MaxQueuedChunks

The number of chunks that can be in-flight at any given time (see ChunkSize). Defaults to ProcessorCount.

public int? MaxQueuedChunks { get; init; }

Property Value

int?

Remarks

This value controls capacity of the bounded Channel<T> used internally.

Unordered

Whether order does not need to be preserved. Set this to true to improve performance when exact record order is not required.
The default is false, which will preserve record order at the cost of more waiting.

public bool Unordered { get; init; }

Property Value

bool

Operators

explicit operator ParallelOptions(in CsvParallelOptions)

Explicitly converts to ParallelOptions for use with TPL methods.

public static explicit operator ParallelOptions(in CsvParallelOptions options)

Parameters

options CsvParallelOptions

Returns

ParallelOptions

explicit operator CsvParallelOptions(ParallelOptions)

public static explicit operator CsvParallelOptions(ParallelOptions options)

Parameters

options ParallelOptions

Returns

CsvParallelOptions

Remarks

Sets the CancellationToken and MaxDegreeOfParallelism properties.

implicit operator CsvParallelOptions(CancellationToken)

Implicitly creates a CsvParallelOptions from a CancellationToken, setting the CancellationToken property.

public static implicit operator CsvParallelOptions(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

CsvParallelOptions