From bdd728e4d331aa89124d113051e4483d040d6ca2 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Sun, 14 Nov 2021 10:32:59 +0100 Subject: [PATCH] Revert a de-optimization from #1734 and add a comment --- src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs index d9d42e061..abe59516f 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs @@ -288,8 +288,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg /// The number of components to write. private void WriteDefineHuffmanTables(int componentCount) { + // This uses a C#'s compiler optimization that refers to the static data segment of the assembly, + // and doesn't incur any allocation at all. // Table identifiers. - ReadOnlySpan headers = stackalloc byte[] + ReadOnlySpan headers = new byte[] { 0x00, 0x10,