From: 조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 Date: Mon, 29 Jun 2020 21:51:32 +0000 (+0900) Subject: Check ascii casing in the candidate process (#254) X-Git-Tag: accepted/tizen/5.5/unified/20200717.033338^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb0359cb975a2e6b4fdc17f07e3a7d35ab9200f5;p=platform%2Fcore%2Fdotnet%2Flauncher.git Check ascii casing in the candidate process (#254) If current culture's casing for ASCII is the same as invariant, it can take a fast path than calling out to the OS for culture-aware casing. However, in certain languages, the "ascii casing check function" may be significantly slowed down. To avoid that kind situation, call it in advance on the candidate process. Change-Id: I46509deec025f724b8fdb3bfd81431e08e611209 --- diff --git a/Managed/Tizen.Runtime/Preloader.cs b/Managed/Tizen.Runtime/Preloader.cs index f0ed99e..5a9f132 100644 --- a/Managed/Tizen.Runtime/Preloader.cs +++ b/Managed/Tizen.Runtime/Preloader.cs @@ -18,14 +18,27 @@ using System; using System.IO; using System.Reflection; using System.Runtime.Loader; +using System.Globalization; namespace Tizen.Runtime { public class Preloader { const string preloadPath = "/usr/share/dotnet.tizen/preload/"; + + // If current culture's casing for ASCII is the same as invariant, it can take a fast path + // than calling out to the OS for culture-aware casing. + // However, in certain languages, the following function may be significantly slowed down. + // To avoid that kind situation, call it in advance on the candidate process. + private static void CheckAsciiCasing() + { + _ = CultureInfo.CurrentCulture.CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", CompareOptions.IgnoreCase); + } + public static void Preload() { + CheckAsciiCasing(); + string[] paths = Directory.GetFiles(preloadPath, "*.preload"); Array.Sort(paths); foreach (string path in paths)