450 likes | 695 Views
Agenda. General Principles.NET Compact Framework OverviewPerformance in the .NET Compact FrameworkCommon Language RuntimeBase Class LibraryFrameworkMeasuring PerformanceSummary. General Principles Golden Rules Of Performance. Make performance a functional requirementSet performance goals a
E N D
1. .NET Compact Framework Performance Tips, Tricks And Best Practices Jonathan Wells
jonwells@microsoft.comblogs.msdn.com/onoj
Product Manager
Smart Client / Mobility
Microsoft Corporation
2. Agenda General Principles
.NET Compact Framework Overview
Performance in the .NET Compact Framework
Common Language Runtime
Base Class Library
Framework
Measuring Performance
Summary
3. General PrinciplesGolden Rules Of Performance Make performance a functional requirement
Set performance goals as early as possible
Revise performance goals at each milestone
Design, code and test for performance throughout application development life-cycle
4. General PrinciplesIn General
Less code is faster code
Fewer objects are better for performance
Recycle and re-use expensive resources
Batch work where possible
Initialize lazily
Do work in the background to affect perceived performance
Use threads and asynchronous calls
Understand what the APIs are doing
5. Agenda General Principles
.NET Compact Framework Overview
Performance in the .NET Compact Framework
Common Language Runtime
Base Class Library
Framework
Measuring Performance
Summary
6. .NET Compact FrameworkDesign Overview
Portable and small .NET common language runtime (clr) for devices
Peacefully co-exist with host OS
Correctness, reliability, performance
Differences from the full .NET Framework 1.0 / 1.1
Size and scalability
No install time JIT (NGEN)
7. .NET Compact FrameworkPerformance Roadmap 1.0 (Feb 2003)
1.0 Service Pack 1 (August 2003)
GUI
Tuned ARM code cache working set
Available on Smart Phone
1.0 Service Pack 2 (December 2003)
XmlTextReader
ADO .Net
Resource manager
1.0 Service Pack 3 (currently in beta)
---
.NET Compact Framework 2.0 (H12005)
Framework, base class libraries and etc XMLTextReader and Data classes were what we focused onXMLTextReader and Data classes were what we focused on
8. Agenda General Principles
.NET Compact Framework Overview
Performance in the .NET Compact Framework
Common Language Runtime
Base Class Library
Framework
Measuring Performance
Summary
9. Common Language RuntimeExecution Engine JIT compilers
Two JIT compiler architectures today
Emulator and ARM device performance experience may be different
Optimizations (ARM)
Method inlining for simple methods
Optimizations are unavailable while debugging from Microsoft Visual StudioŽ
Some optimizations are unavailable when assemblies are compiled as debug
Call path
Properties are calls
Virtual calls are more expensive
Platform Invokes are more expensive
Device Issues
Floating Point
Pocket PC and Smartphone platforms dont have FPUs
Other hardware latency in RAM, I/O, System Buses, Video, SD cards
10. Common Language RuntimeSample Code: Properties Versus Methods class PerformanceTest { int x; public int Method1() { return x; } public int Property1 { get { return x; } } public int Method2() { try { return x; } catch {} } public int Property2 { get { try { return x; } catch{} } } }