Wednesday, March 24, 2010

A last comment on editor/IntelliSense improvements

I got some data on some of the changes the languages team has made from Scott Wiltamuth (PUM of the languages team).

The first change is in the message dispatching priority that we do in keystroke processing. As a user is typing code that involves statement completion UI, we have a choice to make about the relative priority of (a) processing the keystrokes and (b) displaying and rendering the statement completion window. The VS 2008 behavior was to delay the processing of IntelliSense presenters until the WM_KEYDOWN queue is empty. As we transitioned the editor to WPF, the relative priorities changed. Changing them back to something closer to the VS 2008 behavior made a huge difference. The new code is show below, with the change highlighted (in case you can’t see the highlight, it’s “DispatcherPriority.Background”):

public void QueueSpaceReservationStackRefresh()


if (Interlocked.CompareExchange(ref _queuedSpaceReservationStackRefresh, 1, 0) == 0)


this.Dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(delegate


Interlocked.Exchange(ref _queuedSpaceReservationStackRefresh, 0);

if (!_isClosed)




return null;

}), null);



This one change generated huge wins on some of the typing tests that we use – between 39% and 55% from one build to the next!

The second change was to re-use rather than re-create the statement completion window, so that when you type o.Foo.Bar, we reuse the statement completion window that displayed “Foo” for the statement completion of “Bar”.

Combined, these performance wins will make a big difference, especially for fast typists who have slow graphics hardware or are using virtualization. Here are the % changes for some of our C# typing scenarios:

No comments:

Post a Comment