The code will be
recompiled if it??™s called again.
The CLR may also perform optimizations at run time, unlike native applications, where
these optimizations are defined at compile time. Since final compilation occurs at run time in
the CLR, optimizations can be applied at any time. If it??™s the case that the CLR can compile
code faster with fewer optimizations, it will default to doing it that way. For code that??™s called
CHAPTER 5 n VB 2008 AND THE CLR 87
frequently, the CLR can recompile such code with more optimizations turned on, allowing the
compiled code to execute faster. For example, the CLR efficiency model can be vastly different
depending on how many CPUs exists on the target platform. For native applications, you must
do more manual work, either at run time or compile time, to accommodate such a situation.
But multi-CPU performance enhancements come for free with the CLR. Additionally, if the
CLR determines that different parts of code, scattered all over the application, are called rather
frequently, it will move them into memory so that they are located in the same group of memory
pages. This minimizes the amount of page faults and increases the cache hits as the
application runs.
Understanding Assemblies
An assembly is a self-describing, discrete unit of reusable code within the CLR.
Pages:
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172