I think your missing the point of what a list is in ColdFusion in relationship
to what an array or structure is. A list is simply a string that will have to be
parsed by CF to be seen as a collection of data. After its been parsed it can
then be searched. That parsing, especially when done in Java is what the true
question is. Will a structure, which already has the individual items separated
into storage areas operate faster than a string which has to do more work? I'd
expect the structure to be faster, but its not.
I think that a new array search function might be in order here. Something to
look through an array for a value and return its index.


> I'm not sure what you are really trying to accomplish here. It is a well
> known fact that the data structure of choice to do a linear search
> against is a list. Any linear search is going to be O(N) plus whatever
> overhead each operation incurs and a list has the lowest overhead per
> operation. You only want to use arrays or maps (structs) when you
> require random access to the data. Arrays tend to be a good way of
> representing different types of trees, which generally are the best data
> structures to search for a value against. For example, balanced trees
> can generally offer O(log N) worst case. Finally, maps are generally
> meant to be when you are dealing with known keys. If you know the key, a
> map is O(1) for retrieving the value, which is always going to be better
> than any other data structure. However, if you attempt to search a map
> without knowing a key then you are really no better off than searching a
> list.
>
> See http://www.cs.fiu.edu/~weiss/ for more information on algorithms and
> data structures.
>
> Matt Liotta
> President & CEO
> Montara Software, Inc.
> http://www.montarasoftware.com/
> 888-408-0900 x901
>
> > -----Original Message-----
> > From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 04, 2002 12:06 AM
> > To: CF-Talk
> > Subject: Lists vs. Arrays vs. Structures
> >
> > I'm rewriting my CFMakeTree tag in order to make it tighter and work
> in
> > CFMX
> > better. One of the assumptions I had was that Lists would be
> problematic
> > in
> > comparison to Arrays or Structs. My first test was to find a value in
> one
> > of
> > these data collections.
> > For Lists I used ListFindNoCase. For Arrays, I looped over the array
> to
> > find the
> > value and for Structs I used StructFindValue(). I ran each test in a
> 1000
> > iteration loop to see if anything showed up. On the whole, Arrays took
> the
> > longest, which is to be expected as they had to loop (no native
> arrayfind
> > function). Structures took less then 10% of the array time to search
> and
> > lists
> > took 1/3 of the struct time. The data set was 0-9a-z written out in
> full
> > and the
> > item searched for was the z.
> > So the results are basically that lists are easier to search than
> either
> > structures or arrays.
> > As a side note, I tried using a query of queries and it was much, much
> > slower.
> >
> > The second experiment was to loop over each data collection. In this,
> we
> > see
> > much different results.
> > Arrays were fastest. Lists were anywhere from about as fast as an
> array to
> > twice
> > as slow. Structures tended to be on par with lists, but sometimes
> slower.
> > On the whole, unless you see a need to, I'd stick with using lists in
> > CFMX. I
> > have heard of people who have seen some major slowdowns due to lists
> and
> > I'd
> > love to hear the specifics.
> >
> > Michael Dinowitz
> > Master of the House of Fusion
> > http://www.houseoffusion.com
> >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to