From b2c03c1799b2253468eb2245a1c3f854ca47a17a Mon Sep 17 00:00:00 2001 From: Paulo Morgado <470455+paulomorgado@users.noreply.github.com> Date: Wed, 26 Mar 2025 12:17:25 +0000 Subject: [PATCH 1/3] Refactor buffer allocation in Vp8BitWriter.cs to use Span instead of byte[] in WriteFrameHeader. This change enhances memory efficiency by reducing heap allocations and leveraging stack allocation for better performance. --- src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs b/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs index 81530706d..505f54312 100644 --- a/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs +++ b/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs @@ -604,7 +604,7 @@ internal class Vp8BitWriter : BitWriterBase uint profile = 0; int width = this.enc.Width; int height = this.enc.Height; - byte[] vp8FrameHeader = new byte[WebpConstants.Vp8FrameHeaderSize]; + Span vp8FrameHeader = stackalloc byte[WebpConstants.Vp8FrameHeaderSize]; // Paragraph 9.1. uint bits = 0 // keyframe (1b) From 289470aacab5425fefeb48d84e8175274e149cf5 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 7 Apr 2025 21:50:06 +1000 Subject: [PATCH 2/3] Fix build --- Directory.Build.props | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 26b3cc5af..755cbe3b3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,9 +21,8 @@ - - - preview + + 12.0