Results 1 to 40 of 4215

Thread: CommonControls (Replacement of the MS common controls)

Hybrid View

  1. #1
    Hyperactive Member
    Join Date
    Jan 2012
    Location
    Originally from Europe now in Panama
    Posts
    293

    Re: CommonControls (Replacement of the MS common controls)

    While I’m finetuning the implementation of the VBCCR components in my application, I discovered a significant performance issue in one area.

    I’m using the following steps to show the user a combo with only unique values:

    1. All items are added to a sorted listview
    2. Then go through the listview from the top, removing double items
    3. Last, the remaining items are added to the dropdown

    Using a 1000 records dataset, these were the results:

    - Using a sorted Microsoft Common Controls listview, the process takes 25 milliseconds.
    - Using a sorted VBCCR listview, the process takes 21030 milliseconds.
    - Using a non-sorted VBCCR listview, filling it, setting sorting to true, and then do the rest of the process, takes 138 milliseconds.

    The first and third approach broken down:

    Microsoft ListView
    Fill Listview 8 ms
    Remove Doubles 14 ms
    Fill Combo 3 ms

    VBCCR ListView
    Fill Listview 28 ms
    Switch to sorted 65 ms
    Remove Doubles 40 ms
    Fill Combo 5 ms

    The ListView basically has all properties set to False, except for Enabled, as it's only used behind the scenes, and therefore doesn't need to be displayed, refreshed, etc.

    Note: no further action is expected from my side as I can live with the 138 ms, but I thought to share this to show that different approaches can make a massive difference.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,742

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    While I’m finetuning the implementation of the VBCCR components in my application, I discovered a significant performance issue in one area.

    I’m using the following steps to show the user a combo with only unique values:

    1. All items are added to a sorted listview
    2. Then go through the listview from the top, removing double items
    3. Last, the remaining items are added to the dropdown

    Using a 1000 records dataset, these were the results:

    - Using a sorted Microsoft Common Controls listview, the process takes 25 milliseconds.
    - Using a sorted VBCCR listview, the process takes 21030 milliseconds.
    - Using a non-sorted VBCCR listview, filling it, setting sorting to true, and then do the rest of the process, takes 138 milliseconds.

    The first and third approach broken down:

    Microsoft ListView
    Fill Listview 8 ms
    Remove Doubles 14 ms
    Fill Combo 3 ms

    VBCCR ListView
    Fill Listview 28 ms
    Switch to sorted 65 ms
    Remove Doubles 40 ms
    Fill Combo 5 ms

    The ListView basically has all properties set to False, except for Enabled, as it's only used behind the scenes, and therefore doesn't need to be displayed, refreshed, etc.

    Note: no further action is expected from my side as I can live with the 138 ms, but I thought to share this to show that different approaches can make a massive difference.
    Well. The MS ListView will sort kind of "PostMessage" style so you cannot compare it directly.
    I think that the VBCCR ListView will sort "directly" is rather a feature than a bug.
    You do it correctly that you disable the sort while populating.
    I found some spots where maybe a few milliseconds can be saved (e.g. store AddressOf in a variable etc.) When sorting after each insert. However, that fact is neglibile when sorting only once when insertions are finished.

    But you can improve by eliminating the duplicates already in the recordset. Also the sorting could be outsourced to the recordset. And ultimate performance would be to make the ListView virtual and fetch the visible viewport data from the recordset only when needed.

  3. #3
    Hyperactive Member
    Join Date
    Jan 2012
    Location
    Originally from Europe now in Panama
    Posts
    293

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    I think that the VBCCR ListView will sort "directly" is rather a feature than a bug.
    I agree.

    Quote Originally Posted by Krool View Post
    I found some spots where maybe a few milliseconds can be saved (e.g. store AddressOf in a variable etc.) When sorting after each insert. However, that fact is neglibile when sorting only once when insertions are finished.
    I wouldn't bother if I were you.

    Quote Originally Posted by Krool View Post
    But you can improve by eliminating the duplicates already in the recordset. Also the sorting could be outsourced to the recordset. And ultimate performance would be to make the ListView virtual and fetch the visible viewport data from the recordset only when needed.
    The dataset is a collection of a custom class, not a recordset. There actually are multiple, but one example is CProduct, with properties like ID, Name, Supplier. I'm using the described process with a sorted ListView to get a list of Suppliers without duplicates. It seemed the simplest and quickest approach back in the days when I added that feature.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width