JsonbWriterOptions

Namespace: SnowBank.Data.Json.Binary · struct

Options to configure the behavior of the Jsonb parser

Properties

Capacity

int? Capacity { get; set; }

Initial capacity (in bytes) allocated for the output buffer

It is best to slightly overestimate the required size, since undershooting by even 1 byte would trigger an extra resize that would waste up to 50% of the allocated memory.

HashingThreshold

int? HashingThreshold { get; set; }

All object with at least this number of elements will be hashed

Object with an embedded hash table are faster when performing random key lookups, but will take more space (about 5 to 6 bytes per entry)

Since computing the hashcode as some overhead, this can be slower for small object. Empirical testing shows that the cross-over point for performance is around 20 items.

To completely disable hashing, set this value to MaxValue. To force hashing for all objects, set this value to 0

Fields

DefaultCapacity

const int DefaultCapacity

Default initial buffer capacity

DefaultHashingThreshold

const int DefaultHashingThreshold

Default threshold for hashing large objects