Wednesday, August 07, 2013

Got a need for speed? .NET apps start faster.

This post was written by Rich Lander, who works as a Program Manager on the .NET Framework. He worked on AutoNGEN for Windows 8.

This post focuses on how technologies such as Native Image Generator (NGEN), the .NET Framework Optimization Service (mscorsvw), AutoNGEN, and compilation in the cloud have improved the startup performance of .NET apps. (If you want to speed up mscorsvw on your machine, read Wondering why mscorsvw.exe has high CPU usage? You can speed it up.)

Use any apps? Pretty much all the time, right? You probably expect most apps, whether they check the weather or a stock price, to start up fast—you're only willing to wait so long. If you expect to spend a longer time with an app or you pay a subscription for it, you will probably wait a little longer. We've been making apps faster for over 10 years now, on Windows and Windows Phone, to reduce your wait.

App performance comes down to the work that the computer, phone, or tablet needs to do in order to get the app up and running. Some of that work requires number crunching by the CPU and some of it involves opening relatively large files on the hard disk. It was pretty obvious to us, back in the early 2000s, that we could improve performance by making efficient use of various aspects of computer hardware. We did that with our Native Image Generator (NGEN) technology. This is what you see in Windows, with substantial updates in Windows 8 and 8.1.

Starting about five years ago, we saw that computers were getting smaller instead of bigger. They were also becoming more portable, and spending more time running on a battery than connected to the wall. Phones and tablets were part of that trend. We had to make our NGEN technology work on smaller devices. This is what you see in Windows Phone 8.

We've had plenty of customer feedback throughout the past decade asking us to make app launch faster, on desktops as well as phone and tablets. This post is a look back at the work that we've done for app launch over the last 10 years, to answer those requests.

Doing work ahead of time with NGEN

We saw the need for a key performance technology before we shipped .NET Framework 1. We invented a new technology called NGEN to meet those needs. It was included in our first release.

Initially, we saw two major challenges:

Computers were doing a lot of repetitive work to run .NET apps.
Computers were spending a lot more time reading .NET app files than necessary.

QR: Inline image 1