性能测试的步骤:
 
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里的指标数量级都很小,没必要比较了。
 
表格一
LoaderTotal Program Run Time (ms)100289The elapsed time from CLR invocation.
LoaderApp Domains Created1The count of App Domains created in the process.
LoaderApp Domains Unloaded0The count of App Domains that have been unloaded from the process.
LoaderAssemblies Loaded8The count of assemblies that have been loaded - across all App Domains.
LoaderClasses Loaded800The count of classes that have been loaded - across all App Domains.
LoaderMethods Loaded2727The total count of methods loaded - across all App Domains.
GenericsClosed Types Loaded43The count of unique generic types that have been loaded across all AppDomains.
GenericsOpen Types Loaded8The count of open generic types created across all AppDomains. Open types are typically created only in Reflection scenarios.
GenericsClosed Methods Loaded1The count of unique generic methods that have been loaded across all AppDomains.
GenericsOpen Methods Loaded0The count of open generic methods created across all AppDomains. Open methods are typically created only in Reflection scenarios.
Locks and ThreadsThreads in Thread Pool7The number of threads currently in the thread pool.
Locks and ThreadsPending Timers2The number of timers currently waiting to fire.
Locks and ThreadsScheduled Timers797The number of timers that are currently running or scheduled to run.
Locks and ThreadsTimers Delayed by Thread Pool Limit0The count of timers that have been delayed by the thread pool limit.
Locks and ThreadsWork Items Queued187The count of work items queued to the Thread Pool.
Locks and ThreadsUncontested Monitor.Enter Calls36428Count of calls made to Monitor.Enter that are not contested.
Locks and ThreadsContested Monitor.Enter Calls609Count of calls made to Monitor.Enter with lock contention.
GCPeak Bytes Allocated (native + managed)2813480The maximum number of bytes in use by the CLR including both native and managed memory.
GCManaged Objects Allocated109649The count of objects allocated by the Garbage Collector.
GCManaged Bytes Allocated7529264The count of bytes allocated by the Garbage Collector.
GCManaged String Objects Allocated32081The number of managed string objects allocated by the Garbage Collector.
GCBytes of String Objects Allocated2583250The count of bytes of string objects allocated by the Garbage Collector.
GCGarbage Collections (GC)7The number of times the Garbage Collector has run.
GCBytes Collected By GC7252376The count of bytes collected by the Garbage Collector.
GCManaged Bytes In Use After GC164896The number of live objects after the last Garbage Collection.
GCTotal Bytes In Use After GC2807984The number of bytes of memory
GCGC Compactions6The number of times the Garbage Collector has compacted the heap.
GCCode Pitchings0The number of times the Garbage Collect has pitched JIT compiled code.
GCCalls to GC.Collect0The number of times the application has called the GC.Collect() method.
GCGC Latency Time (ms)392The total time (in milliseconds) that the Garbage Collector has taken to collect objects and compact the heap.
GCPinned Objects71The count of pinned objects encountered while performing a Garbage Collection.
GCObjects Moved by Compactor8962The count of objects moved by the Garbage Collector during a compaction.
GCObjects Not Moved by Compactor7006The count of the objects that could not be moved by the Garbage Collector during a compaction.
GCObjects Finalized188The count of objects for which a finalizer have been run.
GCBoxed Value Types7887The number of value types that have been boxed.
MemoryProcess Heap289288The number of bytes currently in use by the CLR's default heap.
MemoryShort Term Heap0The number of bytes currently in use by the CLR's short term heap.
MemoryJIT Heap811200The number of bytes in use by the JIT compiler's heap.
MemoryApp Domain Heap461424The number of bytes in use by the CLR's App Domain heap.
MemoryGC Heap1245184The number of bytes in use by the Garbage Collector heap.
JITNative Bytes Jitted824048The count of bytes of native code generated by the JIT compiler.
JITMethods Jitted1923The count of methods generated by the JIT compiler.
JITBytes Pitched0The count of bytes of native code generated by the JIT compiler which is pitched.
JITMethods Pitched0The count of methods generated by the JIT compiler which is pitched.
JITMethod Pitch Latency Time (ms)0The total time (in milliseconds) spent pitching methods generated by the JIT compiler.
ExceptionsExceptions Thrown5057The count of managed exceptions that have been thrown.
InteropPlatform Invoke Calls0The count of Platform Invoke calls from managed code to native call
InteropCOM Calls Using a vtable0The count of calls from managed code to native code using the COM Interop vtable method.
InteropCOM Calls Using IDispatch0The count of calls from managed code to native code using the COM Interop IDispatch method.
InteropComplex Marshaling1639The number of objects marshaled from managed code to native code that involved copying or transforming the data.
InteropRuntime Callable Wrappers0The total count of COM Runtime Callable Wrappers that have been created.
NetworkingSocket Bytes Sent25800The total count of bytes sent via sockets.
NetworkingSocket Bytes Received336116The total count of bytes received via sockets.
Windows.FormsControls Created10The total number of controls created by the application.
Windows.FormsBrushes Created53The total number of brushes created by the application.
Windows.FormsPens Created53The total number of pens created by the application.
Windows.FormsBitmaps Created42The total number of bitmaps created by the application.
Windows.FormsRegions Created1The total number of regions created by the application.
Windows.FormsFonts Created4The total number of fonts created by the application.
Windows.FormsGraphics Created (FromImage)0The total number of graphics objects created by 'FromImage'.
Windows.FormsGraphics Created (CreateGraphics)0The total number of graphics objects created by 'CreateGraphics'.
 
表格二
 
LoaderTotal Program Run Time (ms)100175The elapsed time from CLR invocation.
LoaderApp Domains Created1The count of App Domains created in the process.
LoaderApp Domains Unloaded0The count of App Domains that have been unloaded from the process.
LoaderAssemblies Loaded5The count of assemblies that have been loaded - across all App Domains.
LoaderClasses Loaded578The count of classes that have been loaded - across all App Domains.
LoaderMethods Loaded1581The total count of methods loaded - across all App Domains.
GenericsClosed Types Loaded29The count of unique generic types that have been loaded across all AppDomains.
GenericsOpen Types Loaded6The count of open generic types created across all AppDomains. Open types are typically created only in Reflection scenarios.
GenericsClosed Methods Loaded2The count of unique generic methods that have been loaded across all AppDomains.
GenericsOpen Methods Loaded0The count of open generic methods created across all AppDomains. Open methods are typically created only in Reflection scenarios.
Locks and ThreadsThreads in Thread Pool23The number of threads currently in the thread pool.
Locks and ThreadsPending Timers0The number of timers currently waiting to fire.
Locks and ThreadsScheduled Timers343The number of timers that are currently running or scheduled to run.
Locks and ThreadsTimers Delayed by Thread Pool Limit0The count of timers that have been delayed by the thread pool limit.
Locks and ThreadsWork Items Queued254The count of work items queued to the Thread Pool.
Locks and ThreadsUncontested Monitor.Enter Calls3266Count of calls made to Monitor.Enter that are not contested.
Locks and ThreadsContested Monitor.Enter Calls116Count of calls made to Monitor.Enter with lock contention.
GCPeak Bytes Allocated (native + managed)2098104The maximum number of bytes in use by the CLR including both native and managed memory.
GCManaged Objects Allocated73723The count of objects allocated by the Garbage Collector.
GCManaged Bytes Allocated4744848The count of bytes allocated by the Garbage Collector.
GCManaged String Objects Allocated19218The number of managed string objects allocated by the Garbage Collector.
GCBytes of String Objects Allocated2539130The count of bytes of string objects allocated by the Garbage Collector.
GCGarbage Collections (GC)4The number of times the Garbage Collector has run.
GCBytes Collected By GC4174544The count of bytes collected by the Garbage Collector.
GCManaged Bytes In Use After GC32236The number of live objects after the last Garbage Collection.
GCTotal Bytes In Use After GC2097568The number of bytes of memory
GCGC Compactions2The number of times the Garbage Collector has compacted the heap.
GCCode Pitchings0The number of times the Garbage Collect has pitched JIT compiled code.
GCCalls to GC.Collect0The number of times the application has called the GC.Collect() method.
GCGC Latency Time (ms)196The total time (in milliseconds) that the Garbage Collector has taken to collect objects and compact the heap.
GCPinned Objects5The count of pinned objects encountered while performing a Garbage Collection.
GCObjects Moved by Compactor970The count of objects moved by the Garbage Collector during a compaction.
GCObjects Not Moved by Compactor163The count of the objects that could not be moved by the Garbage Collector during a compaction.
GCObjects Finalized19The count of objects for which a finalizer have been run.
GCBoxed Value Types13207The number of value types that have been boxed.
MemoryProcess Heap183712The number of bytes currently in use by the CLR's default heap.
MemoryShort Term Heap0The number of bytes currently in use by the CLR's short term heap.
MemoryJIT Heap492104The number of bytes in use by the JIT compiler's heap.
MemoryApp Domain Heap307808The number of bytes in use by the CLR's App Domain heap.
MemoryGC Heap1114112The number of bytes in use by the Garbage Collector heap.
JITNative Bytes Jitted474172The count of bytes of native code generated by the JIT compiler.
JITMethods Jitted1065The count of methods generated by the JIT compiler.
JITBytes Pitched0The count of bytes of native code generated by the JIT compiler which is pitched.
JITMethods Pitched0The count of methods generated by the JIT compiler which is pitched.
JITMethod Pitch Latency Time (ms)0The total time (in milliseconds) spent pitching methods generated by the JIT compiler.
ExceptionsExceptions Thrown30The count of managed exceptions that have been thrown.
InteropPlatform Invoke Calls1The count of Platform Invoke calls from managed code to native call
InteropCOM Calls Using a vtable0The count of calls from managed code to native code using the COM Interop vtable method.
InteropCOM Calls Using IDispatch0The count of calls from managed code to native code using the COM Interop IDispatch method.
InteropComplex Marshaling4The number of objects marshaled from managed code to native code that involved copying or transforming the data.
InteropRuntime Callable Wrappers0The total count of COM Runtime Callable Wrappers that have been created.
NetworkingSocket Bytes Sent7729The total count of bytes sent via sockets.
NetworkingSocket Bytes Received158827The total count of bytes received via sockets.
Windows.FormsControls Created1The total number of controls created by the application.
Windows.FormsBrushes Created73The total number of brushes created by the application.
Windows.FormsPens Created1The total number of pens created by the application.
Windows.FormsBitmaps Created26The total number of bitmaps created by the application.
Windows.FormsRegions Created0The total number of regions created by the application.
Windows.FormsFonts Created3The total number of fonts created by the application.
Windows.FormsGraphics Created (FromImage)0The total number of graphics objects created by 'FromImage'.
Windows.FormsGraphics Created (CreateGraphics)2The total number of graphics objects created by 'CreateGraphics'.