From c40c3905e2836e8b105406430c33659a84c2e3ca Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Wed, 19 Oct 2022 01:31:34 +0200 Subject: Avoid allocations in .Parse methods (#3760) * Avoid allocations in .Parse methods Use the Span overloads of the Parse methods when possible to avoid string allocations and remove one unnecessarry array allocation * Avoid another string allocation --- Ryujinx.HLE/Utilities/StringUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Ryujinx.HLE/Utilities/StringUtils.cs') diff --git a/Ryujinx.HLE/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs index 269f9b55..a64d451c 100644 --- a/Ryujinx.HLE/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -54,7 +54,7 @@ namespace Ryujinx.HLE.Utilities for (int index = 0; index < bytesInHex; index++) { - output[index] = byte.Parse(hexString.Substring(index * 2, 2), NumberStyles.HexNumber); + output[index] = byte.Parse(hexString.AsSpan(index * 2, 2), NumberStyles.HexNumber); } return output; -- cgit v1.2.3