Re: what is faster?
cfif(serializeJSON(qry1) eq serializeJSON(qry2)) to compare 2 queries or sticking the queries into an array and then cfif #qryArray1.equals(qryArray2)# IS YES As several people have described here, you can test this (serially) yourself very easily. But on another note, I really hate these which is faster questions, because (a) the differences are usually trivial, (b) the way most people measure these things is misleading, and (c) there often is no actual right answer. First: assuming that you have a finite amount of time - I think that's a safe assumption - you would be far better served optimizing your SQL and your asynchronous processing. I've been working with CF for many years, and I've looked at a lot of applications, and it's very rare that I find one that has really been fully optimized in those two respects. Those are going to get you a lot more bang for your buck, so to speak. Second: measuring something serially doesn't mean that those measurements will also apply to parallel operations. In other words, what runs faster with one user doesn't necessarily run faster with ten users. You really need to test things concurrently to get a useful measure, and running concurrent tests is time-consuming and expensive, so you really only want to do it when there's a useful payoff. Third: let's say you test this today, in parallel, and find out that one is faster than the other on your version of CF. Will that hold for other versions? I can't count the number of times that I've found legacy code that worked well in one version of CF, but no longer works well in another version. In summary, I recommend you just choose the simplest approach - in this case, the first one - because it will be easy to understand and will work adequately well. Dave Watts, CTO, Fig Leaf Software 1-202-527-9569 http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357879 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: what is faster?
First: assuming that you have a finite amount of time - I think that's a safe assumption - you would be far better served optimizing your SQL and your asynchronous processing. I've been working with CF for many years, and I've looked at a lot of applications, and it's very rare that I find one that has really been fully optimized in those two respects. Those are going to get you a lot more bang for your buck, so to speak. +a lot Most of the CF applications I've worked on in my career haven't been run under real load or scale of any kind (lots of back-office stuff and smaller websites) and I've found that in many cases the which is faster doesn't matter in most cases anymore. It mattered a little bit back in CF4 when the server was a single 500Mhz Pentium III, but with modern versions of CF on modern hardware, the differences are negligible. (Sure there are cases where the CF code is just gross and is impacting performance, but that's a far cry from nitpicking whether expressions should include pound signs or not or if you should have one large cfoutput block or wrap each expression independently like some used to bicker about back in 1999). In the past couple of years I've been working on larger public-facing applications that do run at scale, and have found that the database tends to end up being the bottleneck. Learning about the internals of your database engine and optimizing your data structure, indexes, how execution plans are generated and cached, tuning the queries themselves, and so on has had far more impact on performance than anything in the CF code. -Justin ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357889 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
what is faster?
cfif(serializeJSON(qry1) eq serializeJSON(qry2)) to compare 2 queries or sticking the queries into an array and then cfif #qryArray1.equals(qryArray2)# IS YES ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357860 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: what is faster?
just turn on your debug output and you can test this yourself. runs the first code a few times, look at the average execution time now do the same for the second code On Thu, Mar 6, 2014 at 5:25 PM, Paul Ihrig pih...@gmail.com wrote: cfif(serializeJSON(qry1) eq serializeJSON(qry2)) to compare 2 queries or sticking the queries into an array and then cfif #qryArray1.equals(qryArray2)# IS YES ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357862 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: what is faster?
cfif(serializeJSON(qry1) eq serializeJSON(qry2)) to compare 2 queries or sticking the queries into an array and then cfif #qryArray1.equals(qryArray2)# IS YES TryCF.com is great for stuff like this. Plug this code into TryCF.com and give it a whirl... cfscript qry1 = queryNew(x,y,z); queryAddRow(qry1, 500); qry2 = queryNew(x,y,z); queryAddRow(qry2, 500); timeStart = getTickCount(); for (i=1; i lte 1000; i++) { x = serializeJSON(qry1) eq serializeJSON(qry2); } timeEnd = getTickCount(); writeOutput(pSerialize Time: timeEnd - timeStart ms/p); timeStart = getTickCount(); for (i=1; i lte 1000; i++) { x = qry1.equals(qry2); } timeEnd = getTickCount(); writeOutput(pArray Time: timeEnd - timeStart ms/p); /cfscript ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357863 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: what is faster?
or even www.cflive.net On Thu, Mar 6, 2014 at 5:48 PM, Justin Scott leviat...@darktech.org wrote: cfif(serializeJSON(qry1) eq serializeJSON(qry2)) to compare 2 queries or sticking the queries into an array and then cfif #qryArray1.equals(qryArray2)# IS YES TryCF.com is great for stuff like this. Plug this code into TryCF.com and give it a whirl... cfscript qry1 = queryNew(x,y,z); queryAddRow(qry1, 500); qry2 = queryNew(x,y,z); queryAddRow(qry2, 500); timeStart = getTickCount(); for (i=1; i lte 1000; i++) { x = serializeJSON(qry1) eq serializeJSON(qry2); } timeEnd = getTickCount(); writeOutput(pSerialize Time: timeEnd - timeStart ms/p); timeStart = getTickCount(); for (i=1; i lte 1000; i++) { x = qry1.equals(qry2); } timeEnd = getTickCount(); writeOutput(pArray Time: timeEnd - timeStart ms/p); /cfscript ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357864 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm