Profileoptimization Class: Namespace: Assembly: System - Runtime.Dll
Profileoptimization Class: Namespace: Assembly: System - Runtime.Dll
Definition
Namespace:
System.Runtime
Assembly:
System.Runtime.dll
Improves the startup performance of application domains in applications that
require the just-in-time (JIT) compiler by performing background compilation of
methods that are likely to be executed, based on profiles created during previous
compilations.
C#Copy
public static class ProfileOptimization
Inheritance
Object
ProfileOptimization
Remarks
Important
Each time you initiate profile optimization in an application domain, the profile
that was created during the previous use is read. The information in the profile is
used to guide background compilation by identifying the methods that are most
likely to be executed during startup. On multicore computers, this increases the
chances that a method is already compiled by the time it is needed so that the
main application thread does not have to call the JIT compiler.
The profile file is overwritten on each use, so it always contains the most recent
information about which methods are used during startup.
Optimization profiles are not restricted to application domain startup. They can
be used for any activity that will require heavy use of the JIT compiler. You can
maintain multiple profiles for an application domain so that each such activity has
its own profile.
To use optimization profiles in an application domain, you must call
the SetProfileRoot method and specify the folder where profiles are stored. The
folder must already exist. To begin using a profile, call the StartProfile method
and specify the file name of the profile. If the file was not recorded previously, it
is created on first use. There is no performance benefit the first time a profile is
created.
Profile optimization does not change the order in which methods are executed.
Methods are not executed on the background thread; if a method is compiled
but never called, it is simply not used. If a profile file is corrupt or cannot be
written to the specified folder (for example, because the folder does not exist),
program execution continues without optimization profiling.
Methods
METHODS
SetProfileRoot(String) Enables optimization profiling for the current application domain,
and sets the folder where the optimization profile files are stored. On
a single-core computer, the method is ignored.
StartProfile(String) Starts just-in-time (JIT) compilation of the methods that were
previously recorded in the specified profile file, on a background
thread. Starts the process of recording current method use, which
later overwrites the specified profile file.
Applies to
TABLE 2
Product Introduced
.NET 5.0
.NET Core 3.0
.NET Framework 4.5