December 14th, 2009

A last comment on editor/IntelliSense improvements

Brian Harry
Corporate Vice President

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)

            {

                _spaceReservationStack.Refresh();

            }

            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: 

PU

Scenario

B2Rel.21006
(Run 22042)

vs_langs.21201
(Run 23531)

% Change

VSL C#

Typing – Add classes at end of Large File

71,961.75

47,747.25

33.65%

VSL C#

Typing – After Top Level Edit

117,091.50

54,787.00

53.21%

VSL C#

Typing – In a Deeply Nested Object Initializer

90,684.00

30,404.75

66.47%

VSL C#

Typing – In a Large Method

118,181.50

55,767.25

52.81%

VSL C#

Typing – Large Collection Initializers

170,896.75

83,959.00

50.87%

VSL C#

Typing – Query Expressions

117,562.25

32,993.50

71.94%

Brian

Author

Brian Harry
Corporate Vice President

Corporate Vice President for Cloud Developer Services.

0 comments