Releases: kzdev-net/kzdev.perfutils
KZDev.PerfUtils package v3.0.1
KZDev.PerfUtils package v3.0.0
KZDev.PerfUtils v3 focuses on MemoryStreamSlim API evolution, behavioral alignment with BCL disposal semantics, and expanded modern framework support.
Highlights
- Added
MemoryStreamSlim.ToMemory()andMemoryStreamSlim.ToMemory(MemoryPool<byte>)for pooled, contiguousMemory<byte>export viaIMemoryOwner<byte>. - Improved
MemoryStreamSlimcompatibility with BCL MemoryStream disposed behavior for dynamic-mode streams (Length, Position, and capacity APIs now throw ObjectDisposedException after dispose). - Updated framework support for the 3.x line: targets net8.0, net9.0, and net10.0 (older TFMs, including .NET 6, are no longer shipped).
Breaking Changes
MemoryStreamSlim disposed behavior (dynamic mode)
For dynamic-mode streams (segment/pool-backed instances created without a caller-supplied buffer), the following members now throw ObjectDisposedException after disposal:
- Length
- Position (get/set)
- Capacity (get/set)
- CapacityLong (get/set)
If existing code accessed these members after Dispose(), update that flow to capture values before disposal.
Behavioral Improvement
Fixed mode ToArray() after disposal
For fixed-mode streams (wrapping a caller-provided buffer), ToArray() now behaves like BCL MemoryStream and is allowed after disposal.
Notes on ToMemory()
- Returns a contiguous owner-backed buffer (
IMemoryOwner<byte>) spanning visible bytes from 0..Length. - Uses shared pool by default, or a caller-provided pool.
- For non-empty payloads, callers should
Dispose()the returned owner to return rented buffers. - Integrates with dedicated observability events for ToMemory materialization.
KZDev.PerfUtils package v2.0.1
This release of the 'KZDev.PerfUtils' package fixes a potential internal race condition that could lead to an index out of range exception.
KZDev.PerfUtils package v2.0.0
This release of the 'KZDev.PerfUtils' package:
- Introduces several compression helper classes that use MemoryStreamSlim as the compression destination for improved performance.
- Adds targeted support for .NET 9
MemoryStreamSlimsupports int64 (long) sized streams.
KZDev.PerfUtils package v1.2.0
This release of the 'KZDev.PerfUtils' package introduces the StringBuilderCache class which provides performance enhancements for frequent use of StringBuilders.
In addition, the MemoryStreamSlim class now provides internal memory trimming for memory segments that have not been used for an extended period.
KZDev.PerfUtils package v1.1.0
This release of the 'KZDev.PerfUtils' package contains some additional performance enhancements to the MemoryStreamSlim class and adds the InterlockedOps class which provides additional thread-safe atomic operations beyond those available in the Interlocked class.
KZDev.PerfUtils package v1.0.0
This is the first release of the KZDev.PerfUtils package containing the MemoryStreamSlim class; a high-performance, memory-efficient, and easy-to-use replacement for the MemoryStream class that provides benefits for large or frequently used streams.