>- see footer for list info -<
of course that wont work with
L1 = "10,2,3,4,5,6,7";
L2 = "5,6,7,8,9,1";
this does:
function listMerge(list1,list2){
var tmplist =
replacelist(listqualify(list1,chr(7)),listqualify(list2,chr(7)),"");
return
listappend(arraytolist(listtoarray(replace(tmplist,chr(7),"","ALL"))),list2)
;
}
but its getting ugly now!
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Kerry
Sent: 30 September 2005 10:39
To: Coldfusion Development
Subject: RE: [CF-Dev] Performance Thoughts
>- see footer for list info -<
untested, just an idea for the misuse of replace list:
function listMerge(list1,list2){
var tmplist = replacelist(list1,list2,"");
return listappend(arraytolist(listtoarray(tmplist)),list2);
}
L1 = "1,2,3,4,5,6,7";
L2 = "5,6,7,8,9,10";
writeoutput(listMerge(L1,L2));
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Alex Skinner
Sent: 30 September 2005 10:14
To: 'Coldfusion Development'
Subject: [CF-Dev] Performance Thoughts
>- see footer for list info -<
Hi,
I have two data sets for arguments sake lets say they are both lists. One
will have started life as the result of an xpath and xslt transform and the
other a query which has been valuelisted (is that a word)
Any thoughts for the quickest way of performing an intersection on the two
data sets.
e.g.
data set 1
a,b,c,d,e
dataset 2
a,e,f,g,h,i
intersection = a,e (or present in both)
its not likely the number of items is going to be ever greater than 100 in
each but the data sets will change and this lookup will be called on every
screen of my app, which will be under very high load.
Some people have said convert them into arrays for comparison but that seems
like a parrot fashioned arrays are quicker to analyse than lists argument
and the overhead of conversion may out way the performance benefit.
I have however found this link
http://tools.arlut.utexas.edu/gash2/doc/javadoc/arlut/csd/Util/VectorUtils.h
tml
and
http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_2_1_1/org/
apache/commons/collections/ListUtils.html#intersection(java.util.List,%20jav
a.util.List)
Though that's going to make deployment on bluedragon.net a little
interesting.
Currently my code looks like this.
<cfscript>
/* returns the intersection of two lists */
function listIntersection(lista,listb){
var listab=""; //intersected list
var i=0; //iterator
var liste=""; //list element to check
var ilistlen=listlen(lista);
for (i=1;i lte ilistlen;i=i+1){
liste=listgetat(lista,i);
if (listFind(listb,liste)){
listab=listappend(listab,liste);
}
}
return listab;
}
for (i=1;i lte 100;i=i+1){
//how quick to call 100 times
writeoutput(listIntersection("alex,john,bob","bob,alex,john,james"));
}
</cfscript>
Any help appreciated
Alex
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<