Some benchmarks...
CF5 P550

ArraySort - Averages 90ms
<cfset tList = "10,5,3,6,1,7,8,9,2,4">
<cfset tArray = listToArray(tList)>
<cfloop from="1" to="1000" index="i">
 <cfset rs = arraySort(tArray, "numeric")>
</cfloop>


ListSort - Averages 210ms
<cfset tList = "10,5,3,6,1,7,8,9,2,4">
<cfloop from="1" to="1000" index="i">
 <cfset rs = listSort(tList, "numeric")>
</cfloop>

ArraySort is the clear winner, but the performance difference in the grand
scheme of things is negligible. For the curious cfscript made absolutely no
difference in the times.

jon

----- Original Message -----
From: "Raymond Camden" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, December 03, 2001 8:53 AM
Subject: RE: ArraySort


> What logic do you base this on? As far as I know, arrays are faster, and
> if you think about it, it makes sense. For lists, CF has to parse the
> string to get the correct data. For example:
>
> <CFSET List = "Foo@Goo@Moo@Doo@Doo">
> <CFOUTPUT>#ListGetAt(List,3,"@")#</CFOUTPUT>
>
> In the example above, CF has to parse the string and find the element
> prior  to the 3rd @ sign. Arrays are naturally separated and don't
> require parsing of any kind.
>
> As it stands, if you change your lists to arrays, or arrays to lists,
> just for a minor speed boost, it probably will not be worth your time.
> Use what makes sense for your application.
>
> =======================================================================
> Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
>
> Email    : [EMAIL PROTECTED]
> Yahoo IM : morpheus
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Bryan Love [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, November 30, 2001 8:33 PM
> > To: CF-Talk
> > Subject: RE: ArraySort
> >
> >
> > Actually lists are faster than arrays in CF.  Create a list like so:
> >
> > Last,First~Last2,First2~Last3,First3
> >
> > use listSort() to sort it out
> >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to