During the past two days, I have been preparing for the TechEd 2006 Session. From the foreign PPT, I found that in. NET CF 1.1, two types of JIT-sJIT and iJIT are supported. I didn't expect google to come to such an article and learn to understand it. So I will share it with you.
The original Article is http://www.danielmoth.com/blog/2004_12_01_mothblog_archive.html.
----
Now, all. NET developers all know the managed code (using C #, VB. NET) are compiled into the Intermediate Language (IL, Intermediate Language), and then compiled by the real-Time Compiler (JIT, Just-In-Time) at runtime. Here we will compare the JIT engine in. net cf with the desktop (. NET "Full version") and look at the changes in. net cf 2.0.
Looking back, CF of alpha (pre-RTM) does not have the JIT compiler, and IL is explained on the device. It is not until the RTM version appears (for the CF version, please refer to here) that the IL on the device will be the JIT cost machine code. This compilation is in the unit of method (the same as the full version ). When a method is called, if there is no local code corresponding to this method, IL is compiled as the local code and executed; next time, you only need to directly execute the local code of this method. This means that the performance loss caused by JIT only occurs once.
The main difference is that CF stores the local code loop in the GC heap (that is, in RAM), and performance will occur when a full GC occurs. "Pitching, I don't know if this is a good turning) "(for GC stages, see here ). In other words, the local code generated by JIT is discarded because of the increased memory pressure. Therefore, the next time you call a method, you must re-compile it, as a result, the performance has been bumpy (what does it mean to be fast and slow ?). Do not confuse the Picthing method with the actual data structure (metadata). Metadata will not be "Bumpy" after it is loaded ".
To obtain the numbers (data) related to your CF application, use performance counters. Pay special attention to the following: Bytes Jitted, Native Bytes Jitted, Number Of Methods Jitted, Bytes Pitched, and Nummber Of Methods Pitched.
Another difference is that. net cf does not support ngen. Therefore, you cannot pre-compile an assembly into a local image.
Finally, the size of the code generated by JIT is limited to 64 KB (this restriction is said to have been removed in: 2.0 ). You cannot exceed this limit, but large forms may cause the size of the automatically generated InitializeComponent method to exceed this limit. The solution is to split the method into several smaller methods (the cost is to lose the support of the Form Designer ).
CF 1.0 has two JIT compilers: sJIT and iJIT. The former is dedicated to ARM devices, and the latter is used for CPUs (including SH3, MIPS, and x86) in other architectures ). It takes a long time for sJIT to compile the IL code as the local code, but the generated code is faster than the code generated by iJIT (this PPT provides a detailed description ).
CF 2.0 uses the unified JIT, which is more efficient and optimized than the existing JIT. The simulator released with VS2005 uses the CPU Of the ARM architecture (instead of the existing x86 architecture). Therefore, it is much better in terms of performance.
If you still remember all the CF books I have read, I can tell you that Building Solutions with the CF and CF Kick Start both have paragraphs describing JIT .. Net cf Bible also contributed several pages to introduce the JIT code pool/local image cache.
Happy New Year! (No way. It was written in the original article December 31 .)