性能测试的步骤:
 
1.退出所有Pocket PC应用程序
2.删除所有离线地图
3.运行Compact Framework RPM然后启动Navime
4.界面上一直放大到第四层,移动到北京,再移动到印度
5.停止操作,直到系统运行100000ms 6.获取性能数据
 
表格一是老版本的运行情况,表格二是新版。比较的结果是
 
1. 老版本在80000ms左右才完成操作(所有图片 load 完毕),而新版在500000ms时已经完成,图形下载及加载时间缩小了37%
2. Monitor的使用是新版的10倍,老版本中争用的Monitor.Enter调用占所有Monitor.Enter的1.6%,  新版是3.4%,数字都很低,说明程序中很多锁是没必要的,可以通过逻辑的优化把这些锁去掉
3. 新版在ThreadPool上的利用率明显增加
4. 在垃圾回收这块很多指标是接近的,但老版本GC运行了7次,7 * GC Latency Time= 7 * 392 = 2944ms, 几乎3秒钟华在了GC上,如果392ms发生在屏幕移动过程中,感觉不流畅是难免的。新版的 4 * 196 = 784ms, 好多了 :)
5. 不得不提的是Boxed Value Types, 按照老大们的说法,程序中尽量减少对象的装箱操作。但*有时*为了程序的可扩展性又不得不这样。改
6. 旧版中Exception产生了5057个,程序不慢才怪
7. 到Networking了,呵呵,图片下的应该都是一样的,但发送和接收的流量降低不少。新版里没用系统缺省的WebClient或是HttpRequest,这几个class性能上有很大问题,后面再聊,自己写了个简单的HTTP文件下载类,工作得很好。
8. Windows.Forms里的指标数量级都很小,没必要比较了。
 
表格一
Loader Total Program Run Time (ms) 100289 The elapsed time from CLR invocation.
Loader App Domains Created 1 The count of App Domains created in the process.
Loader App Domains Unloaded 0 The count of App Domains that have been unloaded from the process.
Loader Assemblies Loaded 8 The count of assemblies that have been loaded - across all App Domains.
Loader Classes Loaded 800 The count of classes that have been loaded - across all App Domains.
Loader Methods Loaded 2727 The total count of methods loaded - across all App Domains.
Generics Closed Types Loaded 43 The count of unique generic types that have been loaded across all AppDomains.
Generics Open Types Loaded 8 The count of open generic types created across all AppDomains. Open types are typically created only in Reflection scenarios.
Generics Closed Methods Loaded 1 The count of unique generic methods that have been loaded across all AppDomains.
Generics Open Methods Loaded 0 The count of open generic methods created across all AppDomains. Open methods are typically created only in Reflection scenarios.
Locks and Threads Threads in Thread Pool 7 The number of threads currently in the thread pool.
Locks and Threads Pending Timers 2 The number of timers currently waiting to fire.
Locks and Threads Scheduled Timers 797 The number of timers that are currently running or scheduled to run.
Locks and Threads Timers Delayed by Thread Pool Limit 0 The count of timers that have been delayed by the thread pool limit.
Locks and Threads Work Items Queued 187 The count of work items queued to the Thread Pool.
Locks and Threads Uncontested Monitor.Enter Calls 36428 Count of calls made to Monitor.Enter that are not contested.
Locks and Threads Contested Monitor.Enter Calls 609 Count of calls made to Monitor.Enter with lock contention.
GC Peak Bytes Allocated (native + managed) 2813480 The maximum number of bytes in use by the CLR including both native and managed memory.
GC Managed Objects Allocated 109649 The count of objects allocated by the Garbage Collector.
GC Managed Bytes Allocated 7529264 The count of bytes allocated by the Garbage Collector.
GC Managed String Objects Allocated 32081 The number of managed string objects allocated by the Garbage Collector.
GC Bytes of String Objects Allocated 2583250 The count of bytes of string objects allocated by the Garbage Collector.
GC Garbage Collections (GC) 7 The number of times the Garbage Collector has run.
GC Bytes Collected By GC 7252376 The count of bytes collected by the Garbage Collector.
GC Managed Bytes In Use After GC 164896 The number of live objects after the last Garbage Collection.
GC Total Bytes In Use After GC 2807984 The number of bytes of memory
GC GC Compactions 6 The number of times the Garbage Collector has compacted the heap.
GC Code Pitchings 0 The number of times the Garbage Collect has pitched JIT compiled code.
GC Calls to GC.Collect 0 The number of times the application has called the GC.Collect() method.
GC GC Latency Time (ms) 392 The total time (in milliseconds) that the Garbage Collector has taken to collect objects and compact the heap.
GC Pinned Objects 71 The count of pinned objects encountered while performing a Garbage Collection.
GC Objects Moved by Compactor 8962 The count of objects moved by the Garbage Collector during a compaction.
GC Objects Not Moved by Compactor 7006 The count of the objects that could not be moved by the Garbage Collector during a compaction.
GC Objects Finalized 188 The count of objects for which a finalizer have been run.
GC Boxed Value Types 7887 The number of value types that have been boxed.
Memory Process Heap 289288 The number of bytes currently in use by the CLR's default heap.
Memory Short Term Heap 0 The number of bytes currently in use by the CLR's short term heap.
Memory JIT Heap 811200 The number of bytes in use by the JIT compiler's heap.
Memory App Domain Heap 461424 The number of bytes in use by the CLR's App Domain heap.
Memory GC Heap 1245184 The number of bytes in use by the Garbage Collector heap.
JIT Native Bytes Jitted 824048 The count of bytes of native code generated by the JIT compiler.
JIT Methods Jitted 1923 The count of methods generated by the JIT compiler.
JIT Bytes Pitched 0 The count of bytes of native code generated by the JIT compiler which is pitched.
JIT Methods Pitched 0 The count of methods generated by the JIT compiler which is pitched.
JIT Method Pitch Latency Time (ms) 0 The total time (in milliseconds) spent pitching methods generated by the JIT compiler.
Exceptions Exceptions Thrown 5057 The count of managed exceptions that have been thrown.
Interop Platform Invoke Calls 0 The count of Platform Invoke calls from managed code to native call
Interop COM Calls Using a vtable 0 The count of calls from managed code to native code using the COM Interop vtable method.
Interop COM Calls Using IDispatch 0 The count of calls from managed code to native code using the COM Interop IDispatch method.
Interop Complex Marshaling 1639 The number of objects marshaled from managed code to native code that involved copying or transforming the data.
Interop Runtime Callable Wrappers 0 The total count of COM Runtime Callable Wrappers that have been created.
Networking Socket Bytes Sent 25800 The total count of bytes sent via sockets.
Networking Socket Bytes Received 336116 The total count of bytes received via sockets.
Windows.Forms Controls Created 10 The total number of controls created by the application.
Windows.Forms Brushes Created 53 The total number of brushes created by the application.
Windows.Forms Pens Created 53 The total number of pens created by the application.
Windows.Forms Bitmaps Created 42 The total number of bitmaps created by the application.
Windows.Forms Regions Created 1 The total number of regions created by the application.
Windows.Forms Fonts Created 4 The total number of fonts created by the application.
Windows.Forms Graphics Created (FromImage) 0 The total number of graphics objects created by 'FromImage'.
Windows.Forms Graphics Created (CreateGraphics) 0 The total number of graphics objects created by 'CreateGraphics'.
 
表格二
 
Loader Total Program Run Time (ms) 100175 The elapsed time from CLR invocation.
Loader App Domains Created 1 The count of App Domains created in the process.
Loader App Domains Unloaded 0 The count of App Domains that have been unloaded from the process.
Loader Assemblies Loaded 5 The count of assemblies that have been loaded - across all App Domains.
Loader Classes Loaded 578 The count of classes that have been loaded - across all App Domains.
Loader Methods Loaded 1581 The total count of methods loaded - across all App Domains.
Generics Closed Types Loaded 29 The count of unique generic types that have been loaded across all AppDomains.
Generics Open Types Loaded 6 The count of open generic types created across all AppDomains. Open types are typically created only in Reflection scenarios.
Generics Closed Methods Loaded 2 The count of unique generic methods that have been loaded across all AppDomains.
Generics Open Methods Loaded 0 The count of open generic methods created across all AppDomains. Open methods are typically created only in Reflection scenarios.
Locks and Threads Threads in Thread Pool 23 The number of threads currently in the thread pool.
Locks and Threads Pending Timers 0 The number of timers currently waiting to fire.
Locks and Threads Scheduled Timers 343 The number of timers that are currently running or scheduled to run.
Locks and Threads Timers Delayed by Thread Pool Limit 0 The count of timers that have been delayed by the thread pool limit.
Locks and Threads Work Items Queued 254 The count of work items queued to the Thread Pool.
Locks and Threads Uncontested Monitor.Enter Calls 3266 Count of calls made to Monitor.Enter that are not contested.
Locks and Threads Contested Monitor.Enter Calls 116 Count of calls made to Monitor.Enter with lock contention.
GC Peak Bytes Allocated (native + managed) 2098104 The maximum number of bytes in use by the CLR including both native and managed memory.
GC Managed Objects Allocated 73723 The count of objects allocated by the Garbage Collector.
GC Managed Bytes Allocated 4744848 The count of bytes allocated by the Garbage Collector.
GC Managed String Objects Allocated 19218 The number of managed string objects allocated by the Garbage Collector.
GC Bytes of String Objects Allocated 2539130 The count of bytes of string objects allocated by the Garbage Collector.
GC Garbage Collections (GC) 4 The number of times the Garbage Collector has run.
GC Bytes Collected By GC 4174544 The count of bytes collected by the Garbage Collector.
GC Managed Bytes In Use After GC 32236 The number of live objects after the last Garbage Collection.
GC Total Bytes In Use After GC 2097568 The number of bytes of memory
GC GC Compactions 2 The number of times the Garbage Collector has compacted the heap.
GC Code Pitchings 0 The number of times the Garbage Collect has pitched JIT compiled code.
GC Calls to GC.Collect 0 The number of times the application has called the GC.Collect() method.
GC GC Latency Time (ms) 196 The total time (in milliseconds) that the Garbage Collector has taken to collect objects and compact the heap.
GC Pinned Objects 5 The count of pinned objects encountered while performing a Garbage Collection.
GC Objects Moved by Compactor 970 The count of objects moved by the Garbage Collector during a compaction.
GC Objects Not Moved by Compactor 163 The count of the objects that could not be moved by the Garbage Collector during a compaction.
GC Objects Finalized 19 The count of objects for which a finalizer have been run.
GC Boxed Value Types 13207 The number of value types that have been boxed.
Memory Process Heap 183712 The number of bytes currently in use by the CLR's default heap.
Memory Short Term Heap 0 The number of bytes currently in use by the CLR's short term heap.
Memory JIT Heap 492104 The number of bytes in use by the JIT compiler's heap.
Memory App Domain Heap 307808 The number of bytes in use by the CLR's App Domain heap.
Memory GC Heap 1114112 The number of bytes in use by the Garbage Collector heap.
JIT Native Bytes Jitted 474172 The count of bytes of native code generated by the JIT compiler.
JIT Methods Jitted 1065 The count of methods generated by the JIT compiler.
JIT Bytes Pitched 0 The count of bytes of native code generated by the JIT compiler which is pitched.
JIT Methods Pitched 0 The count of methods generated by the JIT compiler which is pitched.
JIT Method Pitch Latency Time (ms) 0 The total time (in milliseconds) spent pitching methods generated by the JIT compiler.
Exceptions Exceptions Thrown 30 The count of managed exceptions that have been thrown.
Interop Platform Invoke Calls 1 The count of Platform Invoke calls from managed code to native call
Interop COM Calls Using a vtable 0 The count of calls from managed code to native code using the COM Interop vtable method.
Interop COM Calls Using IDispatch 0 The count of calls from managed code to native code using the COM Interop IDispatch method.
Interop Complex Marshaling 4 The number of objects marshaled from managed code to native code that involved copying or transforming the data.
Interop Runtime Callable Wrappers 0 The total count of COM Runtime Callable Wrappers that have been created.
Networking Socket Bytes Sent 7729 The total count of bytes sent via sockets.
Networking Socket Bytes Received 158827 The total count of bytes received via sockets.
Windows.Forms Controls Created 1 The total number of controls created by the application.
Windows.Forms Brushes Created 73 The total number of brushes created by the application.
Windows.Forms Pens Created 1 The total number of pens created by the application.
Windows.Forms Bitmaps Created 26 The total number of bitmaps created by the application.
Windows.Forms Regions Created 0 The total number of regions created by the application.
Windows.Forms Fonts Created 3 The total number of fonts created by the application.
Windows.Forms Graphics Created (FromImage) 0 The total number of graphics objects created by 'FromImage'.
Windows.Forms Graphics Created (CreateGraphics) 2 The total number of graphics objects created by 'CreateGraphics'.