Hi Adam, I tried the regex on my test list and it does work a bit quicker than the QofQ option, but no way near as fast as the java option. Keeping it 100% cf is definately a plus, but the line between java and cf has become somewhat blurry in recent times. If it was very critical and I had massive lists to process I would prolly go with the java option. Below is a list of execution times for a list of 10,000 integers (200 unique).
listFind - 300 ms QofQ - 200 ms Regex - 130 ms java - 10 ms -Jason -----Original Message----- From: [EMAIL PROTECTED] on behalf of Adam Cameron Sent: Mon 10/01/2005 14:50 To: CFAussie Mailing List Subject: [cfaussie] Re: Removing duplicates from a list > return REReplaceNoCase(ListSort(list,type),"([^,]+)(,\1)*","\1","ALL"); > I haven't tested this and I can't vouch for the performance but you have > to admit that (if it works) it is a very cool bit of code... Nice one. Results were pretty much the same for both HashSet and regex versions, but the latter is maybe nicer having the benefit of being native CF (if that's actually a benefit). HOWEVER! It took me a wee bit to work out why the regex one didn't quite work. Rather enigmatically, this will return: 137,141,227,290,296,33,394,481,526,535,58,644,72,861,908,913,925,960 When the answer should actually be: 137,14,141,227,290,296,33,394,481,526,535,58,6,644,72,861,908,913,925,960 Note that the 14 and the 6 have been "deduped" incorrectly. I scratched my head but it's because it's not matching the second grouping correctly: 14,141 is being matched as 14,14 After a bit of scratching around, I came up with this fix for it: REReplaceNoCase(ListSort(list,type),"([^,]+)((,\1)(\b))*","\1\4","ALL"); I tested this over quite a number of iterations and it seems to work OK. -- Adam --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
<<winmail.dat>>
--- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/
