views:

177

answers:

4

I have a windows application in which a form is binded with the data. The form loads slowly because of large data. I am also showing paging in form to navigate through the records.

How to increase the performance?

+2  A: 

It's hard to say for certain without knowing more about your application, but the immediate thing that comes to mind is that if your dataset is large, you should be doing pagination on the database side (by constraining the query using row counts) rather than on the application side.

Databinding is a convenience feature of .NET, but it comes with a severe performance overhead. In general it's only acceptable for working with small datasets of less than a few thousand rows bound to a couple of dozen controls at most. If the datasets grow very large, they take their toll very quickly and no amount of tweaking will make the application speedy. The key is always to constrain the amount of memory being juggled by the data binding system at any given time so that it doesn't overload itself with the meta-processing.

Dan Story
Here is more description of the application:Form has few textboxes and textboxes are loaded with data.Form shows one record at a time, and also implements navigation with next, previous, first and last record.
Manish Gupta
In that case your problem is almost certainly that you're retrieving too much data per query and need to page it server-side. See the documentation for the ROW_NUMBER() function for examples of how to do this: http://msdn.microsoft.com/en-us/library/ms186734.aspx
Dan Story
A: 

If you are using SQL server, implement paging using the Commaon table Expressions and ROW_NUBER(). This will allow you to get less data from the Sql server and definitely better performance.

ydobonmai
+1  A: 
Mehmet Aras
Also, for ease of use, ObjectListView is really helpful (http://www.codeproject.com/KB/list/ObjectListView.aspx)
alex
+3  A: 

Bottom line- your app needs to 'page the data' effectively.

This means, you will need to "lazy load" the data. The UI should only load and display data that it needs to show; therefore load additional data only when needed.

Since you didnt provide much of an information regarding your app and the data that you load.

So, lets assume that your app fetches 10,000,000,01 records.

  • Load your form
  • If, for instance your grid shows 25 records per page, so use TOP 100 to fetch the top 100 records, and fill in your first page and next four pages.
  • Upon each Next or consecutive 'Nexts' you can hit database to fetch next records. Note that, you will require some mechanism(ROW_NUMBER?) to keep track of the records being fetched, row numbers, etc.

This article discusses exactly what you are after and I am referring towards.

KMan