Re: CBS_SORT / LBS_SORT, what algorithm?
- From: "Jialiang Ge [MSFT]" <jialge@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 25 Oct 2008 00:59:35 +0800
Hello ReyesP,
I just get the product group's suggestion on this issue. They also suggest maintaining the sort outside the ComboBox/ListBox control and populate the result to ComboBox/ListBox without SBC_SORT. (They call this as "virtual listbox")
Inside ComboBox, it always uses "Insertion Sort" when SBC_SORT is specified, and a re-sort + re-add of the whole list is also done internally when users add / edit the list items. Insertion sort is a simple sorting algorithm: http://en.wikipedia.org/wiki/Insertion_sort. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. http://en.wikipedia.org/wiki/Sorting_algorithm. In other words, the default implementation of sort in ComboBox does not very fit a large collection of data. Regarding your performance concerns when manually maintaining the sort outside the control, the product group and I compose the following analysis for your reference:
1. We can have a better choice of the sort algorithm according to the operation (insert/update) and the features of the data collection.
For the initial list population, external sorting would be the faster way of doing it since one would likely choose a better sort algorithm than insertion sort. For the incremental update case, doing the lookup/insertion yourself vs. having the control do it wouldn't be any faster if the control did it for you because it's going to be an insertion sort.
2. Benefit of virtual listbox
Virtual listboxes are the way to go since we never insert into the controls but just reflect an external store that likely has an inherent sorting maintained (like a database index, a tree, etc.).
3. We may reuse the sort result in multiple controls.
In this case, we need to display the sort result in two controls: a tree control and a ComboBox control. Instead of sorting twice, we can maintain the sort in one place and simply populate the sort result to the two controls. This can not only ensure that the sort results in both controls are identical, but also improve the overall performance.
ReyesP, is the above info useful to you? Please let me know if you have any concerns or questions. I will spare no effort to help you.
Have a nice weekend!
Best Regards,
Jialiang Ge
Microsoft Online Community Support
=================================================
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@xxxxxxxxxxxxxx
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
""Jialiang Ge [MSFT]"" <jialge@xxxxxxxxxxxxxxxxxxxx> wrote in message news:0vKuceaNJHA.4468@xxxxxxxxxxxxxxxxxxxxxxxxx
Good morning ReyesP. Welcome to Microsoft Newsgroup Support service! My.
name is Jialiang Ge [MSFT]. It's my pleasure to work with you on this issue.
I understand your concerns that overriding sorting with "Owner-Drawn"
causes the ComboBox to lose Accessibility functionality. I also understand
the underlying performance issues if we pre-sort the ComboBox items.
ReyesP, please give me some time. I have conveyed your request to the
product group and am waiting for their suggestions.
To be honest, even if the product group agrees to tell the algorithm of
CBS_SORT in this community, I personally do not suggest programming against
the algorithm because this kind of undocumented implementation may change
in future releases. I have spent several hours on this issue to look for
other more reliable solutions/workarounds. Although I do not have findings
today, I will continue researching with all efforts. Thank you for you
understanding.
Regards,
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- Re: CBS_SORT / LBS_SORT, what algorithm?
- From: ReyesP
- Re: CBS_SORT / LBS_SORT, what algorithm?
- References:
- CBS_SORT / LBS_SORT, what algorithm?
- From: ReyesP
- Re: CBS_SORT / LBS_SORT, what algorithm?
- From: Ivo Beltchev
- Re: CBS_SORT / LBS_SORT, what algorithm?
- From: ReyesP
- Re: CBS_SORT / LBS_SORT, what algorithm?
- From: "Jialiang Ge [MSFT]"
- CBS_SORT / LBS_SORT, what algorithm?
- Prev by Date: Re: Button without focus HowTo?
- Next by Date: Re: CBS_SORT / LBS_SORT, what algorithm?
- Previous by thread: Re: CBS_SORT / LBS_SORT, what algorithm?
- Next by thread: Re: CBS_SORT / LBS_SORT, what algorithm?
- Index(es):
Loading