Reputation: 907
The app I'm working on has a physician look-up list. It's a simple form field that takes an Id and this look-up will allow the user to view the entire list of physicians and add one to the field. We are loading the list in the controller and then returning the list to the view, where the data is formatted in a table.
<div id="physicians-selection-dialog">
<table id="list">
<thead>
<tr>
<td>#</td>
<td>First Name</td>
<td>Last Name</td>
<td>Department</td>
<td>State Lic</td>
</tr>
</thead>
<tbody>
@foreach (var physician in Model.Physicians)
{
<tr><td><button class="list-select" value="@physician.PhysFxId">@physician.PhysFxId</button></td><td>@physician.PhysFirstName</td><td>@physician.PhysLastName</td><td>@physician.PhysDepartment</td><td>@physician.PhysStateLic</td></tr>
}
</tbody>
</table>
</div>
The user clicks a link that displays a jQuery dialog with the above html for all 5k physicians. This works fine, however, it is extremely slow to render. I need to increase the performance but am not certain what I should do?
How can I increase performance here?
Upvotes: 1
Views: 663
Reputation: 7105
What you should really do is only retrieve the physicians needed from the database in the first place. A list of 5000 items is pointless, nobody is going to look through that.
You can implement a paging system that that passes something like page number, page size, and sort criteria to a stored procedure or data layer method. This method will then only retrieve the applicable items from your DB. You will save DB processing time, network transfer time, Business Object creation time, and rendering time in this way.
Upvotes: 12