A workaround to pre-compile internal methods
authorSangwook Kim <swift.kim@samsung.com>
Tue, 8 Oct 2019 04:10:48 +0000 (13:10 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Thu, 10 Oct 2019 23:36:41 +0000 (08:36 +0900)
This patch is to avoid JIT compilation of the following methods on
setEnvironmentVariable() at launch time. These methods are not
subject to AOT compilation even if the system assemblies are fully-
NGENed and IBC-optimized.
- System.SpanHelpers:IndexOf(byref,ubyte,int)
- System.SpanHelpers:Contains(byref,ushort,int)

NativeLauncher/launcher/dotnet/dotnet_launcher.cc

index c13c406..acd97cd 100644 (file)
@@ -442,7 +442,11 @@ int CoreRuntime::initialize(bool standalone)
 
        if (!standalone)
        {
-               preloadTypes();         // Preload common managed code
+               // Preload common managed code.
+               preloadTypes();
+
+               // This redundant call effectively reduces JIT overhead at launch time.
+               setEnvironmentVariable("XDG_DATA_HOME", "/");
        }
 
        _INFO("CoreRuntime initialize success");