Manage an array of unsorted objects. #1273
-
I'm looking to search an roArray of unsorted roAssociativeArray items. The search is based upon a string entered by the user. At the present, I perform a linear search. I'm hoping there's a BrighterScript function or method to perform a faster and more efficient search. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unfortunately no, we haven't included any sort functions in brighterscript. I think those types of enhancements would be better served as third party libraries instead of being embedded in brighterscript, so that way you can upgrade the library independently from brighterscript. rodash has as sortBy function, but looking at the source code it seems to be linear as well. This might be a good opportunity to implement a few of the more popular sorting algorithms, see which one performs best for your needs, and if you're feeling motivated, it could even be released as a ropm module or shareable roku library. |
Beta Was this translation helpful? Give feedback.
Unfortunately no, we haven't included any sort functions in brighterscript. I think those types of enhancements would be better served as third party libraries instead of being embedded in brighterscript, so that way you can upgrade the library independently from brighterscript.
rodash has as sortBy function, but looking at the source code it seems to be linear as well.
This might be a good opportunity to implement a few of the more popular sorting algorithms, see which one performs best for your needs, and if you're feeling motivated, it could even be released as a ropm module or shareable roku library.