Thursday, August 09, 2007

Webcast Review: Building High-Performance Applications Using the .NET Compact Framework

On August 8th, 2007, the Microsoft .NET Compact Framework team's lead software developer, Steven Pratschner, conducted an extremely informative MSDN webcast entitled "Building High-Performance Applications Using the .NET Compact Framework". For people unfamiliar with Steven's blog, performance is a topic which he has covered quite extensively there. This webcast included discussion of a wide array of topics ranging from performance comparisons with native code to the implementation of the .NET CF garbage collector.
There are many notable highlights in this 71 minute webcast including the following subjects:

  • A comparison of method calls on performance:
    • Managed Method calls are 2.3x the cost of a native call
    • Virtual Method calls are 1.5x the cost of a method instance call
    • P/Invoke Method calls are 5x the cost of a managed instance call
    • (Unfortunately though it did not discuss the performance of static methods versus instance methods nor the use of interfaces)
  • The effect of boxing on performance demonstrated through the use of a simple demo game containing a grid of blocks being rotated.
  • How to use the .NET CF Remote Performance Monitor to look at metrics including the total number of garbage collections, memory usage, and objects allocated.
  • How to use the new CLR Profiler, which will be included in version 3.5 of the .NET Compact Framework. This provided detailed information to the level of showing which methods within the demo application were causing a high percentage of object allocations.
  • Why it is better to use an indexer or custom iterator over a foreach statement
Early in the session, Steven mentions how code is just-in-time compiled or jitted, on a per method basis. How code is jitted is important when testing the performance of methods. Steven reveals an extremely useful approach. He says to run the method once so that it gets jitted. Then, call the method again this time measuring for performance. Following these steps gives the true runtime of the method as opposed to the jit time and runtime combined.

Other fascinating topics are discussed including collections, reducing application startup times and reflection. This is definitely a webcast that developers working on enterprise level line of business applications using the .NET CF should watch.

No comments: