Skip Navigation Links.

Logo de MVP

Contactar por correo

Contador gratuito
visitas desde el 22/Sep./02

Este sitio utiliza ASP.NET 2.0

Este sitio se ha hecho y publicado integramente con Visual Studio 2008 y Expression Web

Este sitio utiliza Microsoft Silverlight

Este sitio se ha hecho y publicado integramente con Visual Studio 2008 y Expression Web

Trucos en .NET
Última actualización: 4 de Marzo de 2008
Trucos de rendimiento para Visual Studio 2008

No hay herramienta de desarrollo que no pueda ser optimizada en rendimiento. VS 2008 no es una excepción y lo mismo es válido para el tipo de aplicaciones que se pueden construir con ella. Como todos tenemos que hacer demos en nuestras presentaciones y queremos que funcionen lo más rápidamente posible, es interesante revisar algunos de los trucos más relevantes desde dos puntos de vista: la herramienta misma, y las aplicaciones que podemos construir con ella.

Además, para que cada uno pueda indagar con más profundidad en cada tema de su interés y por razones de espacio (porque sino esto sería un libro y no un artículo de la Cueva del Desarrollo), añado recomendaciones en forma de enlaces para distintos escenarios y características de optimización.

Bajo el punto de vista de VS 2008, he dado con algunos trucos interesantes:

Acerca de las condiciones de los discos duros: Scott Guthrie sugiere algunos trucos curiosos en: " Tip/Trick: Hard Drive Speed and Visual Studio Performance" y el Jefe de la División de Desarrollo en MS-Redmond, Soma Somasegar, también añade los siguientes:

· Reconstruir un proyecto Visual Basic y ejecutar el compilador en “background” es 3 veces más rápido y utiliza un tercio de memoria menos. Más datos sobre esto aquí.

Recorrer ficheros grandes en C# con el Editor es 100% más rápido que antes, mientras que teclear texto nuevo es 50% más rápido.

El tiempo de respuesta de Intellisense con tipos grandes en C# es 10 veces más rápido que antes

La compilación incremental se realiza 90% más rápido en soluciones C++/CLI que anteriormente. Más datos sobre esto en este enlace

Los ficheros de Office Word y Excel, se procesan 20 veces más rápido en el servidor.

El proceso de comandos del control de versión de Team Foundation Server ha sido reescrito para soportar operaciones sin límite de carga en los comandos principales y sin depender de la memoria disponible en el servidor. En las pruebas, los comandos se ejecutaban del 10% al 60% más rápido, con las mejoras más notables asociadas con los proyectos más grandes. Puede leerse más acerca de las mejoras en escalabilidad del TFS aquí y aquí

También existen mejoras de rendimiento que explotan el hardware “multi-core”, por ejemplo el soporte multi-hilo añadido a MSBuild. Además, utilizando el switch /MP switch, puede mejorarse significativamente el tiempo de compilación en proyectos C++ -ellos afirman que se botienen rendimientos de mejora del 30% en la construcción de un Front-End C++ cuando se dispone de este tipo de hardware dual-core. Otras mejoras siginificativas del rendimiento afectan al runtime de NET 3.5 a la hora de gestionar los hilos de ejecución del CLR en aplicaciones multi-hilo de todas clases.

Estos cambios arquitectónicos, cuando se combinan con los cambios en las API’s de sockets, mejoran notablemente los procesos de entrada salida con sockets asíncronos, llegando hasta un 70% con un procesador dual-core disponible. Las implicaciones de estas mejoras en el rendimiento están disponibles aquí.

Por otra parte, o sea, en la optimización de aplicaciones, existen numerosas referencias de interés, dependiendo, otra vez, del tipo de aplicación que se quiere construir. Uno de los mejores sitios sobre optimización de aplicaciones que he visto es el sitio web dotnetslackers.com en su página Performance. Es una colección de enlaces, (incluyendo algunos de los mencionados más arriba) sobre muchísimos trucos y técnicas de optimización.

Todos los atajos de teclado para Visual Studio 2005 (*) 

Visual C# Development Settings Default KeyBindings

Editing

Edit.CollapseToDefinitions

CTRL + M, O

Collapses existing regions to provide a high-level view of the types and members in the source file.

Edit.CommentSelection

CTRL + K, C or CTRL + E, C

Inserts // at the beginning of the current line or every line of the current selection.

Edit.FormatDocument

CTRL + K, D or CTRL + E, D

Formats the current document according to the indentation and code formatting settings specified on the Formatting pane under Tools | Options | Text Editor | C#.

Edit.FormatSelection

CTRL + K, F or CTRL + E, F

Formats the current selection according to the indentation and code formatting settings specified on the Formatting pane under Tools | Options | Text Editor | C#.

Edit.InsertSnippet

CTRL + K,  X

Displays the Code Snippet Picker. The selected code snippet will be inserted at the cursor position.

Edit.StopOutlining

CTRL + M,  P

Removes all outlining information from the whole document.

Edit.SurroundWith

CTRL + K, S

Displays the Code Snippet Picker.  The selected code snippet will be wrapped around the selected text.

Edit.ToggleAllOutlining

CTRL + M, L

Toggles all previously collapsed outlining regions between collapsed and expanded states.

Expand Code Snippet

[TAB]

Expand Code Snippet

Edit.ToggleOutliningExpansion

CTRL + M, M

Toggles the currently selected collapsed region between the collapsed and expanded state.

Edit.UncommentSelection

CTRL + K, U or CTRL + E, U

Removes the // at the beginning of the current line or every line of the current selection.

Edit.CycleClipboardRing

CTRL + SHIFT + V

Pastes text from the Clipboard ring to the cursor location in the file. Subsequent use of the shortcut key iterates through the items in the Clipboard ring.

Edit.Replace

CTRL + H

Displays the replace options in the Quick tab of the Find and Replace dialog box.

Edit.ReplaceInFiles

CTRL + SHIFT + H

Displays the replace options on the In Files tab of the Find and Replace dialog box.

View.ShowSmartTag

CTRL + . or SHIFT + ALT + F10

Displays the available options on the smart tag menu.

Edit.InvokeSnippetFromShortcut

TAB

Inserts the expanded code snippet from the shortcut name.

 

 

File

File.NewProject

CTRL + SHIFT + N

Displays the New Project dialog box.

File.OpenProject

CTRL + SHIFT + O

Displays the Open Project dialog box, where existing projects can be added to the solution.

Project.AddClass

SHIFT + ALT + C

Displays the Add New Item dialog box and selects Class template as default.

Project.AddExistingItem

SHIFT + ALT + A

Displays the Add Existing Item dialog box, where existing files can be added to the current project.

Project.AddNewItem

CTRL + SHIFT + A

Displays the Add New Item dialog box, where a new file can be added to the current project.

Window.ShowEzMDIFileList

CTRL + ALT + DOWN ARROW

Displays a pop-up listing of all open documents.

Edit.OpenFile

CTRL + O

Displays the Open File dialog box where a file can be selected to be opened.  This does not add the file to the project.

 

 

IntelliSense

Edit.CompleteWord

CTRL + SPACE or CTRL + K, W

Completes the current word in the completion list.

Edit.ListMembers

CTRL + J or CTRL + K, L

Invokes the IntelliSense completion list.

Edit.QuickInfo

CTRL + K, I

Displays the complete declaration for the specified identifier in your code in a Quick Info tool tip.

Edit.ParameterInfo

CTRL + SHIFT + SPACE or CTRL K, P

Displays the name, number and type of parameters required for the specified method.

 

 

Navigation

Edit.FindAllReferences

SHIFT + F12 or CTRL + K, R

Displays a list of all references for the symbol selected.

Edit.GoToBrace

CTRL + ]

Moves the cursor location to the matching brace in the source file.

Edit.GoToDefinition

F12

Navigates to the declaration for the selected symbol in code.

Edit.GoToNextLocation

F8

Moves the cursor to the next item, such as a task in the Task List window or a search match in the Find Results window. Subsequent invocations will move to the next item in the list.

Edit.IncrementalSearch

CTRL + I

Activates incremental search. If incremental search is on, but no input is passed, the previous search query is used. If search input has been found, next invocation searches for the next occurrence of the input text.

View.ClassViewGoToSearchCombo

CTRL + K, CTRL + V

Brings focus to the Class View search box.

View.ForwardBrowseContext

CTRL + SHIFT + 7

Moves to the next item called in code in the current file.  Uses the Go To Definition navigation stack.

View.NavigateBackward

CTRL + MINUS SIGN (-)

Moves to the previously browsed line of code.

View.NavigateForward

CTRL + SHIFT + MINUS SIGN (-)

Moves to the next browsed line of code.

View.PopBrowseContext

CTRL + SHIFT + 8

Moves to the previou