- Load fewer modules at startup
- Precompile assemblies using NGen
- Place strong-named assemblies in the GAC
- Avoid base address collisions
- dumpbin can check the preferred base address of Dlls.
- Avoid blocking on the UI thread
- Perform lazy processing
- Some operations can be implemented in the Idle event and will be processed when applications are idle.
- Populate controls more quickly
- The following code snippet shows how to avoid constant repainting.
listView1.BeginUpdate();
for(int i = 0; i < 10000; i++)
{
ListViewItem listItem = new ListViewItem("Item"+i.ToString() );
listView1.Items.Add(listItem);
}
listView1.EndUpdate(); - Exercise more control over data binding
- BindingSource can help improve performance.
this.bindingSource1.SuspendBinding();
for (int i = 0; i < 1000; i++)
{
tbl.Rows[0][0] = "suspend row " + i.ToString();
}
this.bindingSource1.ResumeBinding(); - Reduce repainting
- Use SuspendLayout method whenever possible to minimize the number of Layout events.
- Call Invalidate method and pass the area that needs to be repainted as an argument to Invalidate.
- Use double buffering
- Manage memory usage
- If controls are added and removed from WinForm dynamically, call Dispose on them. Otherwise, extra unwanted handles would be accumulated in the process.
- Use reflection wisely
Monday, January 28, 2008
Tips For Boosting .NET WinForm Performance
In this MSDN article, tips were suggested for boosting .NET WinForm Performance and I summarized as follows.
Subscribe to:
Post Comments (Atom)
2 comments:
Can anyone recommend the well-priced Network Management software for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central service management
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!
Nice tips, to automate winform dataentry form development check http://razaimran.blogspot.com/
Post a Comment