tracker issue : CF-4153051

select a category, or use search below
(searches all categories and all time range)

[ANeff] ER for: struct.toUnordered()

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 05/14/2016

Components: Language, Member Functions

Versions: 2016

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Minor / Unknown

Locale/System: English / Win All

Vote Count: 0

Struct should have a .toUnordered() member function for converting ordered-to-unordered w/o using StructNew().

For ordered-to-unordered conversion, please compare these:
unordered = structNew().append(anyStruct);//currently possible
unordered = anyStruct.toUnordered();//cleaner

This ER is for a struct.toUnordered() member function.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4153051

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:



What's the actual use case for this? In what way might one - already having an OrderedStruct - find one's self going "actually I need this to be an unordered struct? The difference is a lack of ordering... if one doesn't care about the ordering, then simply *keep not caring*. The language does not need a tider construct for this, because it's not the sort of thing one would generally need or even want to do.
Comment by External U.
2792 | May 19, 2016 12:45:46 PM GMT
Aaron, we don't see a compelling use-case here.
Comment by Vamseekrishna N.
2793 | June 22, 2016 12:35:03 AM GMT
Hi Adam and Vamsee, The difference is also in the performance. Retrieving from an ordered struct is less performant than retrieving from an ordered struct, right? If so, one should be able to use anyStruct.toUnordered() to create an unordered struct from an ordered struct. Use case is when one needs to do a lot of retrieval from a struct in scenarios where order doesn't matter but performance does. Thanks!, -Aaron
Comment by External U.
2794 | July 05, 2016 03:56:41 AM GMT
Hi Aaron, performance is actually better in case of ordered struct. The underlying datastructure we are using for ordered struct is 50% better than for normal struct if you are iterating over it.(for collection loop in CF) Getting the value by key will perform exactly similar. Though the creation is little slower(approx 30%) but in our case struct is already created. So why convert it back to normal struct? So will ask you again to provide use case. P.S: performance numbers mentioned are just for reference and in any case cannot be used as guideline.
Comment by Milan C.
2795 | July 05, 2016 07:11:49 AM GMT
Hi Milan, Amazing! Please disregard this ticket then :) Could the performance benefit of iterating over ordered (vs unordered) struct please be documented in the performance white paper here: Should I log an ER to have this done? That's very good news! Thanks!, -Aaron
Comment by External U.
2796 | July 05, 2016 01:18:22 PM GMT
Since the function struct.ToUnordered does not have a compelling case and performance of Ordered structs are indeed better than unordered one I am closing the bug! @ Aaron, You may log an enhancement for the performance white paper of Ordered Struct. We will look into releasing the numbers . Thanks, Suchika
Comment by Suchika S.
2797 | July 14, 2016 06:43:45 AM GMT
Hi Suchika, Very cool, thanks very much! I've logged ER CF-4172644 for documenting ordered struct's performance improvement. Thanks!, -Aaron
Comment by External U.
2798 | July 14, 2016 11:16:06 AM GMT