1

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?

  1. Should I cache the physician list, so it doesn't need to keep loading the 5k objects every time the view is loaded? That list is being loaded from the DB. This list will never or rarely change, so that isn't a worry.
  2. Is there a way to cache the html output?
  3. Paginate the data, but I think they want a top down list. Faster to scroll than keep clicking next.

How can I increase performance here?

2
  • 5
    have you considered to use paging?
    – Bolu
    Nov 13, 2012 at 14:45
  • 1
    provide a search function, a dropdown list is not a place for 5,000 items. Nov 13, 2012 at 14:48

1 Answer 1

13

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.

1
  • You can also use jqgrid for paging results. I have very good results with it.
    – Iulian
    Nov 13, 2012 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.