From 69634aa998bcf6b1c78d2751b1ddc0aa61a96aa8 Mon Sep 17 00:00:00 2001 From: Todd Grunke Date: Sat, 13 Dec 2025 08:17:13 -0800 Subject: [PATCH] Copy slightly less data during SourceText.computeContentHash As outlined in a comment in the code, just use ImmutableCollectionsMarshal.AsImmutableArray to make the code a bit simpler and more efficient. --- src/Compilers/Core/Portable/Text/SourceText.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Compilers/Core/Portable/Text/SourceText.cs b/src/Compilers/Core/Portable/Text/SourceText.cs index 885c88e18e46e..97f0f07d291f0 100644 --- a/src/Compilers/Core/Portable/Text/SourceText.cs +++ b/src/Compilers/Core/Portable/Text/SourceText.cs @@ -656,10 +656,7 @@ ImmutableArray computeContentHash() hash.Append(MemoryMarshal.AsBytes(charSpan)); } - // Switch this to ImmutableCollectionsMarshal.AsImmutableArray(hash.GetHashAndReset()) when we move to S.C.I v8. - Span destination = stackalloc byte[128 / 8]; - hash.GetHashAndReset(destination); - return destination.ToImmutableArray(); + return ImmutableCollectionsMarshal.AsImmutableArray(hash.GetHashAndReset()); } finally {