Open cd21h opened 8 months ago
Tagging subscribers to this area: @dotnet/area-system-memory See info in area-owners.md if you want to be subscribed.
Author: | shatl |
---|---|
Assignees: | - |
Labels: | `area-System.Memory` |
Milestone: | - |
Tagging subscribers to this area: @dotnet/area-extensions-logging See info in area-owners.md if you want to be subscribed.
Author: | shatl |
---|---|
Assignees: | - |
Labels: | `untriaged`, `area-Extensions-Logging` |
Milestone: | - |
@shatl the suggested code will not compile for netstandard2.0/NET Framework. But it is possible to optimize it for these two targets by using unsafe code. Are you interested to submit a PR for that?
Will do
There is an opportunity to remove memory application by replacing string with shared buffer:
https://github.com/dotnet/runtime/blob/2df640c9cb9cd3b50225b9a4fa65e8f414f50bdf/src/libraries/Microsoft.Extensions.Logging.Console/src/JsonConsoleFormatter.cs#L79
textWriter.Write(Encoding.UTF8.GetString(output.WrittenMemory.Span));
can be replaced with