From 06082a42bc720d2009763d725676b3d803b86829 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Mon, 14 Feb 2022 13:40:45 -0600 Subject: [PATCH] Remove Unused Encoding on UriHelper This field was a left-over artifact from conflicts between the commits: - https://github.com/dotnet/runtime/commit/70c070e84c617de0700612d03c5886e548195bed - https://github.com/dotnet/runtime/commit/e53e5430c199c210b7d6f7ce508fb5fabb5faeba In profiling the startup of a Maui Android app, this initialization is pulling in UTF32 and Latin1 encodings. The profile indicates this accounts for 7ms (roughly 1%). Removing this unnecessary field eliminates 7ms in a Maui App's InitializeComponent. --- src/libraries/System.Private.Uri/src/System/UriHelper.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libraries/System.Private.Uri/src/System/UriHelper.cs b/src/libraries/System.Private.Uri/src/System/UriHelper.cs index 660d15d..0165a49 100644 --- a/src/libraries/System.Private.Uri/src/System/UriHelper.cs +++ b/src/libraries/System.Private.Uri/src/System/UriHelper.cs @@ -4,15 +4,11 @@ using System.Text; using System.Diagnostics; using System.Runtime.InteropServices; -using System.Buffers; namespace System { internal static class UriHelper { - internal static readonly Encoding s_noFallbackCharUTF8 = Encoding.GetEncoding( - Encoding.UTF8.CodePage, new EncoderReplacementFallback(""), new DecoderReplacementFallback("")); - // http://host/Path/Path/File?Query is the base of // - http://host/Path/Path/File/ ... (those "File" words may be different in semantic but anyway) // - http://host/Path/Path/#Fragment -- 2.7.4