You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added Compression Class functionality with different compression classes.
- Added first elements to support stream compression and also cleaned up auto-properties by providing [DebuggerStepThrough] attributes.
- Added initial MemoryStreamSlim.Compress methods for passing a source stream.
- Added Compress method to MemoryStreamSlim for passing byte[] source data.
Refactor compression functionality in MemoryStreamSlim
- Updated `CompressionType.cs` to include a summary for the `CompressionType` enum, defining the ZLib algorithm.
- Enhance string compression in MemoryStreamCompression
- Updated `MemoryStreamCompression.cs` to improve string compression functionality. Key changes include reducing the maximum anticipated compression size from 512 MB to 256 MB, adding overloads for `CreateCompressionOutput` to handle string inputs, and modifying Brotli, ZLib, Deflate, and GZip methods to support string data using `StreamWriter`. New public methods for compressing strings with customizable options and encoding were introduced, along with improved documentation for clarity.
- Optimize MemoryStreamSlim creation for compression
- Introduce new methods for creating MemoryStreamSlim instances with initial capacity based on source data length to improve memory usage during compression. Update existing methods to utilize these new overloads, including support for MemoryStreamSlimOptions. Modify Create methods to accept options by reference, enhancing performance by reducing unnecessary copies.
- Added support for asynchronous compression when compressing a source stream.
- Introduced `MemoryStreamBrotliCompressionOptions` and `MemoryStreamZLibCompressionOptions` for specific compression settings.
- Updated the compression options types to support extended functionality in .NET 9
- Add the dedicated compression extension methods for Deflate, GZip, and ZLib compression types.
- Added compression options unit tests
- Enhance MemoryStreamSlim functionality and documentation
- Updated the MemoryStreamSlimOptions to have the zero buffer behavior be 'init' instead of 'set' to allow initial values on creation of the options.
- Added Brotli compression support and updated some MemoryStreamSlim unit tests to support the new options setup configuration.
- Implement GZip compression and unit tests
- Created or updated `UsingMemoryStreamGZip.cs` to include unit tests for the `MemoryStreamGZip` class, covering multiple scenarios and ensuring data integrity after compression and decompression. Utilized FluentAssertions for improved test readability.
Copy file name to clipboardExpand all lines: Source/Docs/articles/memory-monitoring.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -238,7 +238,8 @@ The following table shows the event data.
238
238
239
239
### MemoryStreamSlimToArray event
240
240
241
-
This event is raised when the ToArray() method is called on a `MemoryStreamSlim` instance and returns a non-zero length array. This is useful for tracking extra heap memory allocations caused by calling the ToArray() method.
241
+
This event is raised when the ToArray() method is called on a `MemoryStreamSlim` instance and returns a non-zero length array. This is useful for tracking extra heap memory allocations caused by calling the ToArray() method. This also records the internal operation of putting all of the
242
+
bytes into a contiguous array for decoding the bytes into a string.
242
243
243
244
The following table shows the task, keyword, level, and opcode.
244
245
@@ -256,7 +257,9 @@ The following table shows the event data.
256
257
257
258
| Name | Type | Description |
258
259
| --- | --- | --- |
260
+
| StreamId | Guid | The unique identifier for the MemoryStreamSlim instance. |
259
261
| ArraySize | Int32 | The size (in bytes) of the returned heap allocated array. |
262
+
| StringDecode | Int32 | Indicates if the contiguous array was used for string decoding. 0 = ToArray() called, 1 = Decode() called. |
Compression is often used with memory streams to reduce the size of the data being stored or transmitted. This can be particularly useful when dealing with large amounts of data or when bandwidth is limited.
4
+
5
+
.NET provides several classes for compression, including `GZipStream` and `DeflateStream`, which can be used in conjunction with memory streams. To simplify the process of compressing and decompressing data, helper classes exist in this library, such as `MemoryStreamGZip` and `MemoryStreamDeflate`. These classes provide a convenient way to handle compression without having to manually manage the underlying streams.
6
+
7
+
## Helper Classes
8
+
9
+
The full list of helper classes available for compression are:
10
+
11
+
-`MemoryStreamGZip`: A helper class that uses GZip compression with a memory stream.
12
+
-`MemoryStreamDeflate`: A helper class that uses Deflate compression with a memory stream.
13
+
-`MemoryStreamBrotli`: A helper class that uses Brotli compression with a memory stream.
14
+
-`MemoryStreamZLib`: A helper class that uses ZLib compression with a memory stream.
Compression is often used with memory streams to reduce the size of the data being stored or transmitted. This can be particularly useful when dealing with large amounts of data or when bandwidth is limited.
4
+
5
+
.NET provides several classes for compression, including `GZipStream` and `DeflateStream`, which can be used in conjunction with memory streams. To simplify the process of compressing and decompressing data, helper classes exist in this library, such as `MemoryStreamGZip` and `MemoryStreamDeflate`. These classes provide a convenient way to handle compression without having to manually manage the underlying streams.
6
+
7
+
## Helper Classes
8
+
9
+
The full list of helper classes available for compression are:
10
+
11
+
-`MemoryStreamGZip`: A helper class that uses GZip compression with a memory stream.
12
+
-`MemoryStreamDeflate`: A helper class that uses Deflate compression with a memory stream.
13
+
-`MemoryStreamBrotli`: A helper class that uses Brotli compression with a memory stream.
14
+
-`MemoryStreamZLib`: A helper class that uses ZLib compression with a memory stream.
0 commit comments