3 Replies Latest reply on Jun 3, 2009 1:29 PM by stickamw

    Performance Questions


      We have an application with users who have individuals.


      At one point, they can search through their individuals.


      Most people will have 50 - 100, some will have up to 1000, and a few could have many more.


      I need to implement a search function and I am wondering what the best way to do it would be.



      My thoughts so far:


      Option 1: When this piece (module) of the application loads, I grab all individuals and store it in a global array collection, so I can use filter function as they search.


      Option 2: Everytime I need to search I pass a search query to the back end (ruby on rails) and return the results.





      Our milestone says they need to be refreshed on 'keyUp', so Option 2 could be very slow and resource heavy.  Option 1 seems like the smarter decision but I am wondering how it will work if they have to store/filter an array of a potential large amount of individuals (mind you only the top 10 results will be displayed and filtering will stop after that).


      If you know any other solutions, please tell me!

        • 1. Re: Performance Questions
          stickamw Level 1

          Hi there...


          Can you provide a few more details about what you are using to hold these individuals?


          For our uses, we have thousands of rows (one row per individual) stored in an ArrayCollection (which is the dataProvider for our ADG) and we've setup a search function for the individual name in the row.  When a user provides a search string and clicks a "search" button, we simply loop through our array,  identifying the row index for every place the search value is found, and storing those indices in a new array.  Once that's complete, we simply loop through our indices array and use the adg.scrollToIndex function as well as the adg.selectedItem property to scroll to and highlight the found value.  If the indices array has a length > 1, then we change the text of our button from 'search' to 'next' which upon successive clicks just continues to loop through our indices array.


          We have also done a more complex version of this using hierarchical data (grouping collection) in and ADG and found success setting up a dictionary and utilizing a cursor handler.




          1 person found this helpful
          • 2. Re: Performance Questions
            andrewthorp Level 1



            I wanted to know if the arraycollection can handle large amounts of data efficiently.



            • 3. Re: Performance Questions
              stickamw Level 1

              Well, here is what I can tell you...


              In our experience, the arrayCollection is great at handling a ton of data....our largest is about 125 columns X 5000 rows...and no problems on the collection itself, including sorting.


              the problems we most commonly encounter occur when we assign that as the dataProvider for an ADG, with or without a groupingCollection...then have any significant number of itemRenderers on that data.  That's when we start getting performance nightmares and wicked memory leaks (though Adobe has apparently addressed the memory leak issue that was plaguing the custom itemRenderers).