Jon, That makes sense I suppose. The REMatchGroups() has to create some Java objects which must have some overhead. Plus it is creating arrays and structs and some grunt work. This might come out faster on big things, but for smaller things, the simplier approach might prevail.
Thanks for the feedback. ...................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -----Original Message----- From: Jon Clausen [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 11:44 AM To: CF-Talk Subject: Re: Using reReplace Backreference as StructKey or Argument Ben, Agreed, the Len/Pos array loops are ugly and a pain to deal with. Hence my attempts to bypass all of that by finding a way to pass the backreference directly in reReplace... :-) Got around to running timers comparing reFind and your reMatchGroups function against each other. The first set ran both options together in the same function and produced significantly faster results for rematchGroups. The next 5 sets were done in a loop with both functions side by side. reMatchGroups came out ahead again on the average. When I ran each timer by itself, revmoving the other from the function, reFind() came out faster on both sets (plus a few more attempts I didn't capture in these results). While not exactly scientific, the timer results are included below (tab separated - sorry for the formatting in plain text): Timer Run Using ReFind(ms) Using RematchGroups(ms) Base Run 5276 2879 Loop 1 4241 3434 Loop 2 4109 3284 Loop3 3440 3080 Loop 4 3290 2894 Loop 5 2994 3209 Solo Run 1 3975 4675 Solo Run 2 3501 3556 Average 3853.25 3376.375 Difference -14.12% 12.38% Machine Info: CF8 | 2GHz Macbook Pro 2GB RAM Based on the results, It seems that reMatchGroups has a speed advantage with a high load, but reFind seems to perform better in a single request. There were no database calls in the timers to cloud the results. Interesting stuff! Jon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Check out the new features and enhancements in the latest product release - download the "What's New PDF" now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293479 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4