Re: So... cfmodule is slow...?
On Friday, Sep 19, 2003, at 23:09 US/Pacific, Adam Churvis wrote: the two main things that got me about CFIMPORT was that you couldnt use a variable to target the custom tag library location since its a compile-time directive Correct. You can use a mapping however and that can be controlled from the CF Admin - that's as 'dynamic' as it gets. secondly importing the entire library of custom tags at that location, which sounded like a lot of unnecessary overhead on each page request. Which you now know is not true! :) Without that, our software wouldnt be easy to deploy in a shared environment where the mapping name you hard-coded into all those CFIMPORT calls during development wasnt available when it came time to deploy on a box that had a hundred other sites on it-- and one of them got your mapping name first. Choose a mapping that uniquely identifies your software. If the software's that big and important, I doubt you'd want to deploy it on a box shared with a hundred other sites, surely? All this being said, would you seriously consider amending your ColdFusion MX Coding Guidelines regarding the use of CFMODULE? cfmodule is banned in our environment. I have, however, adjusted the wording to read: Don't use cfmodule It's slower than a CFC method invocation, it's slower and uglier than using a custom tag with a prefix, it's even slightly slower than a regular custom tag invocation. Better options exist: use a CFC (preferred), use cfimport and invoke a custom tag (always preferable to invoking a custom tag via cfmodule) or even simply including a file. This will be in the 3.0.1 version that I'll put out shortly (allowing for more public input). Just from this discussion today, I dont think the claim of slow really holds up anymore, I disagree. In terms of straight line speed it is clearer slower than the cfimport/prefix invocation. nor does the claim that it encourages some very unstructured usage. Even tho' I've dropped that comment from the coding guidelines, I stand by it. cfmodule was introduced into the language to provide a workaround for the name clashes caused by the search order for custom tags. It was a patch, nothing more, because custom tags themselves are not a very structured way to program (but, back in the day, there was nothing better). CFCs provide much more structure so, except in places where a custom tag is more idiomatic - which the coding guidelines do allow for - custom tags in general are frowned upon here (by my team). in light of what Ive mentioned about maintainability (especially in shared hosting environments), CFIMPORT isnt always preferable to CFMODULE. As I said, these coding guidelines are written from the perspective of the team that built macromedia.com and, for us, cfimport *is* always preferable to cfmodule. I really want to clear up these rumors, and your very influential guidelines document would be a great place to set the record straight. Well, that document will continue to say Don't use cfmodule because I believe it is far from best practice with CFMX 6.1. Best practice changes over time. cfmodule might have been best practice in earlier versions of CF but now they are better ways to handle complex libraries of code. Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137936 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
Re: So... cfmodule is slow...?
Sean, Thanks for discussing this topic with me and with the rest of the list. The reason why this is so important to me is because we have something big that were about to launch that makes extensive use of a fairly large custom tag library, and weve looked at how to handle them from many different aspects, including things like shared hosting environments, software maintainability, etc. Each technique for calling custom tags had its advantages and disadvantages, but the two main things that got me about CFIMPORT was that you couldnt use a variable to target the custom tag library location since its a compile-time directive, and secondly importing the entire library of custom tags at that location, which sounded like a lot of unnecessary overhead on each page request. If only it were named CFMAPTAGNAMESPACE instead. ;) What absolutely killed CFIMPORT for us was the inability to represent the custom tag library location as a persistent variable that we could set as needed. Without that, our software wouldnt be easy to deploy in a shared environment where the mapping name you hard-coded into all those CFIMPORT calls during development wasnt available when it came time to deploy on a box that had a hundred other sites on it-- and one of them got your mapping name first. All this being said, would you seriously consider amending your ColdFusion MX Coding Guidelines regarding the use of CFMODULE? Just from this discussion today, I dont think the claim of slow really holds up anymore, nor does the claim that it encourages some very unstructured usage. And in light of what Ive mentioned about maintainability (especially in shared hosting environments), CFIMPORT isnt always preferable to CFMODULE. There is a lot of misleading information about CFMODULE going around, including one I heard recently that each call to CFMODULE generates its own separate HTTP request. I really want to clear up these rumors, and your very influential guidelines document would be a great place to set the record straight. Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137793 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: So... cfmodule is slow...?
Calvin Ward [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] http://www.corfield.org/coldfusion/coding_standards/performance.html But is it slower than cf_ ? Efficiency stems more from good design than from good coding. Robert L. Glass More computing sins are committed in the name of [execution] efficiency (often without achieving it) than for any other single reason, including blind stupidity. - W.A.Wulf Focusing too heavily on optimization techniques often results in code that is difficult or impossible to understand and mantain. - Eric M. Burke :-))) Massimo ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137649 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: So... cfmodule is slow...?
With all due respect, I beg to differ. In CFMX 6.1, CFMODULE is not slow at all when you're using the template= syntax. Sean, would you please tell me if you think my statement above is incorrect? Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! - Original Message - From: Calvin Ward [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, September 19, 2003 5:10 AM Subject: So... cfmodule is slow...? http://www.corfield.org/coldfusion/coding_standards/performance.html But is it slower than cf_ ? - Calvin ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137665 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
RE: So... cfmodule is slow...?
Everything is relative. A lot of time was spent, for example, improving the speed of CFCs in MX 6.1 - so they are much faster than Custom Tags now. But some time was also spent improving Custom Tags - so they are faster than they've ever been. In general it still seems that in order of speed you see function, CFC, then Custom Tag (before MX 6.1 the last two were switched). (You can see this easily - just create a Hello World function, CFC and custom tag and run them 1000 times in a GetTickCount()) BUT - all of these are running so fast now this should only be a concern if you're instantiated thousands. I'm all for enhancing performance, but the decision to use these is definitely architectural and shouldn't be impacted by performance concerns. At least in my opinion. ;^) Jim Davis -Original Message- From: Adam Churvis [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2003 10:47 AM To: CF-Talk Subject: Re: So... cfmodule is slow...? With all due respect, I beg to differ. In CFMX 6.1, CFMODULE is not slow at all when you're using the template= syntax. Sean, would you please tell me if you think my statement above is incorrect? Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! - Original Message - From: Calvin Ward [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, September 19, 2003 5:10 AM Subject: So... cfmodule is slow...? http://www.corfield.org/coldfusion/coding_standards/performance.html But is it slower than cf_ ? - Calvin ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137680 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
Re: So... cfmodule is slow...?
I'm all for enhancing performance, but the decision to use these is definitely architectural and shouldn't be impacted by performance concerns. I wholeheartedly agree, Jim. My point of contention was whether or not Sean thought that CFMODULE on CFMX 6.1 using template= syntax was slow because we use custom tags quite a bit here. Our custom tags often in turn call component methods that do all the heavy lifting, and the custom tags handle the display. CFMODULE directly addresses each custom tag as it is used, it eliminates the Little Bo Peep behavior of having to search for the custom tag being called, and it completely eliminates occlusion in shared hosting environments where custom tags may be named the same across different custom tag paths defined in CF Administrator. I just really wanted to hear what Sean had to say about these things because I respect his opinion very much, as I do yours. Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! - Original Message - From: Jim Davis [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, September 19, 2003 11:52 AM Subject: RE: So... cfmodule is slow...? Everything is relative. A lot of time was spent, for example, improving the speed of CFCs in MX 6.1 - so they are much faster than Custom Tags now. But some time was also spent improving Custom Tags - so they are faster than they've ever been. In general it still seems that in order of speed you see function, CFC, then Custom Tag (before MX 6.1 the last two were switched). (You can see this easily - just create a Hello World function, CFC and custom tag and run them 1000 times in a GetTickCount()) BUT - all of these are running so fast now this should only be a concern if you're instantiated thousands. I'm all for enhancing performance, but the decision to use these is definitely architectural and shouldn't be impacted by performance concerns. At least in my opinion. ;^) Jim Davis -Original Message- From: Adam Churvis [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2003 10:47 AM To: CF-Talk Subject: Re: So... cfmodule is slow...? With all due respect, I beg to differ. In CFMX 6.1, CFMODULE is not slow at all when you're using the template= syntax. Sean, would you please tell me if you think my statement above is incorrect? Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! - Original Message - From: Calvin Ward [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, September 19, 2003 5:10 AM Subject: So... cfmodule is slow...? http://www.corfield.org/coldfusion/coding_standards/performance.html But is it slower than cf_ ? - Calvin ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137687 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
Re: So... cfmodule is slow...?
The 'search' for the tag, though, is done once. That's why if you move a custom tag after it has been called once, you need to restart MX for it to 'look' for it again. That being said - I prefer cfmodule w/ template so I can specify exactly where MX should run the tag - this is extremely important for boxes where you may have multiple versions of the same tag. -Ray -- Original Message -- From: Adam Churvis [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Fri, 19 Sep 2003 12:21:35 -0400 I'm all for enhancing performance, but the decision to use these is definitely architectural and shouldn't be impacted by performance concerns. I wholeheartedly agree, Jim. My point of contention was whether or not Sean thought that CFMODULE on CFMX 6.1 using template= syntax was slow because we use custom tags quite a bit here. Our custom tags often in turn call component methods that do all the heavy lifting, and the custom tags handle the display. CFMODULE directly addresses each custom tag as it is used, it eliminates the Little Bo Peep behavior of having to search for the custom tag being called, and it completely eliminates occlusion in shared hosting environments where custom tags may be named the same across different custom tag paths defined in CF Administrator. I just really wanted to hear what Sean had to say about these things because I respect his opinion very much, as I do yours. Respectfully, Adam Phillip Churvis Member of Team Macromedia ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137689 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
Re: So... cfmodule is slow...?
On Friday, Sep 19, 2003, at 09:21 US/Pacific, Adam Churvis wrote: My point of contention was whether or not Sean thought that CFMODULE on CFMX 6.1 using template= syntax was slow because we use custom tags quite a bit here. slow in comparison to, say, CFC method invocation. You must remember that these coding guidelines are written from the perspective of my team's software experience which, in general, leans toward CFCs instead of custom tags and, where we use custom tags, we like to tightly control their use - hence the recommendations for cfimport to identify the path to the tags and to create unique 'namespaces' to invoke the custom tags. And, as Jim says, this is more of an architectural decision than a performance based one. Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137775 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Re: So... cfmodule is slow...?
On Friday, Sep 19, 2003, at 16:24 US/Pacific, Sean A Corfield wrote: slow in comparison to, say, CFC method invocation. So I went back and did some linear timings... yeah, I know they don't tell you 'real world' performance but it was interesting nonetheless: I ran these three tests in a long loop: #1: cf_tag (with tag.cfm in same directory) #2: cfmodule template=tag.cfm #3: cfimport taglib=. prefix=x/ x:tag x:tag was the fastest - by quite a margin; next was cf_tag; slowest was cfmodule. There wasn't a huge difference between cf_tag and cfmodule tho'. Here's a sample result for 100,000 iterations: cf_tag: 12148 cfmodule: 13497 x:tag: 9465 tag.cfm contains just: cfoutput/cfoutput The test file looks like this: cfoutput cfset a = getTickCount()/ cfloop index=i from=1 to=10 cf_tag /cfloop cfset b = getTickCount()/ cf_tag: #b-a#br / cfset a = getTickCount()/ cfloop index=i from=1 to=10 cfmodule template=tag.cfm /cfloop cfset b = getTickCount()/ cfmodule: #b-a#br / cfimport taglib=. prefix=x / cfset a = getTickCount()/ cfloop index=i from=1 to=10 x:tag /cfloop cfset b = getTickCount()/ x:tag: #b-a#br / /cfoutput Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137783 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
Re: So... cfmodule is slow...?
Sean, Thanks for your reply! :) I'd like to get your opinion on something else, if I may. If a system makes extensive use of a good-sized library of custom tags throughout an application (virtually on every page), and the logic and display tasks handled by them are truly best implemented as custom tags (many of which internally call components that interface with the persistence layer), wouldn't using CFIMPORT on every page (which redundantly re-imports the entire library of custom tags with each page request) be considered a second-best approach in favor of discrete calls via CFMODULE template= to just those custom tags needed on each page? I can see using CFIMPORT for the occasional call to a custom tag in a relatively small library (or subdirectory of a library) of custom tags, but it seems to me that when you have a lot of them and use them just about everywhere that CFMODULE template= is the best approach, both from an architectural and a performance point of view. I'm really interested in hearing your thoughts on this. I really respect you and your opinions. Thanks in advance. Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! - Original Message - From: Sean A Corfield [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, September 19, 2003 7:24 PM Subject: Re: So... cfmodule is slow...? On Friday, Sep 19, 2003, at 09:21 US/Pacific, Adam Churvis wrote: My point of contention was whether or not Sean thought that CFMODULE on CFMX 6.1 using template= syntax was slow because we use custom tags quite a bit here. slow in comparison to, say, CFC method invocation. You must remember that these coding guidelines are written from the perspective of my team's software experience which, in general, leans toward CFCs instead of custom tags and, where we use custom tags, we like to tightly control their use - hence the recommendations for cfimport to identify the path to the tags and to create unique 'namespaces' to invoke the custom tags. And, as Jim says, this is more of an architectural decision than a performance based one. Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137785 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: So... cfmodule is slow...?
Sean, Forgive me for pressing the issue, but I think it's critically important here for people to understand what is and isn't happening in your test. You say I know they don't tell you 'real world' performance but it was interesting nonetheless, but I would think that all interest is lost unless there is some relation to real applications. Publishing numbers like this can mislead a lot of people in very wrong directions. First, CFIMPORT is running only once, but the x:tag is being called 100,000 times. In the real world, CFIMPORT would be called on every page using a custom tag. Second, you're not using an entire library of custom tags, so CFIMPORT isn't doing anything near what it would in a real application, where it has to import an entire directory of custom tags every time it is called on a page request (not just once before a loop within a single page). Third, you're calling all syntaxes on the same page. I would think this would skew the numbers substantially, even though you're separately timing each. Fourth, your CF_tag example has the tag in the same directory as the calling template, so you're not getting any hit from having to search for the tag, which typically happens in real applications. If these points I make are not well founded then please let me know. This is a very important issue for a lot of people. I'm not trying to harsh on you at all; I just need to acid test the premises I have been going on, and I sincerely appreciate your help with this. Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive ColdFusion MX Training ColdFusion MX Master Class: September 22 - 26, 2003 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! - Original Message - From: Sean A Corfield [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, September 19, 2003 9:02 PM Subject: Re: So... cfmodule is slow...? On Friday, Sep 19, 2003, at 16:24 US/Pacific, Sean A Corfield wrote: slow in comparison to, say, CFC method invocation. So I went back and did some linear timings... yeah, I know they don't tell you 'real world' performance but it was interesting nonetheless: I ran these three tests in a long loop: #1: cf_tag (with tag.cfm in same directory) #2: cfmodule template=tag.cfm #3: cfimport taglib=. prefix=x/ x:tag x:tag was the fastest - by quite a margin; next was cf_tag; slowest was cfmodule. There wasn't a huge difference between cf_tag and cfmodule tho'. Here's a sample result for 100,000 iterations: cf_tag: 12148 cfmodule: 13497 x:tag: 9465 tag.cfm contains just: cfoutput/cfoutput The test file looks like this: cfoutput cfset a = getTickCount()/ cfloop index=i from=1 to=10 cf_tag /cfloop cfset b = getTickCount()/ cf_tag: #b-a#br / cfset a = getTickCount()/ cfloop index=i from=1 to=10 cfmodule template=tag.cfm /cfloop cfset b = getTickCount()/ cfmodule: #b-a#br / cfimport taglib=. prefix=x / cfset a = getTickCount()/ cfloop index=i from=1 to=10 x:tag /cfloop cfset b = getTickCount()/ x:tag: #b-a#br / /cfoutput Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137786 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
Re: So... cfmodule is slow...?
On Friday, Sep 19, 2003, at 19:46 US/Pacific, Adam Churvis wrote: First, CFIMPORT is running only once, but the x:tag is being called 100,000 times. In the real world, CFIMPORT would be called on every page using a custom tag. Correct. But cfimport is a *compiler* directive and doesn't really do anything other than instruct the compiler how to process prefix:tagname. Second, you're not using an entire library of custom tags, so CFIMPORT isn't doing anything near what it would in a real application, where it has to import an entire directory of custom tags every time it is called on a page request (not just once before a loop within a single page). See above - cfimport doesn't *do* anything other than tell the compiler what to do with the prefix:tagname calls. I re-ran the test with an empty loop and a loop running just cfimport (both 100,000 times): empty loop: 470 cf_tag: 12413 cfmodule: 13180 cfimport: 526 x:tag: 10653 Hopefully this shows that cfimport isn't doing anything worthwhile at runtime? I expect the (small) difference is due to the whitespace generated by the additional blank line in the cfimport loop... Third, you're calling all syntaxes on the same page. I would think this would skew the numbers substantially, even though you're separately timing each. How would it skew the numbers? Have you split the test file into three separate files to see if it actually does change the timings? (It might, I've no idea - but I'd be surprised if it did) Fourth, your CF_tag example has the tag in the same directory as the calling template, so you're not getting any hit from having to search for the tag, which typically happens in real applications. Well, it *is* searching but it's finding it immediately. Given how CFMX caches the location of each and every custom tag it invokes, I'd be surprised if the actual location of the custom tag made a huge difference. I just need to acid test the premises I have been going on, and I sincerely appreciate your help with this. I'd strongly suggest you conduct tests of your own to satisfy your curiosity. Seriously! I can knock up any number of simple, inline tests but I can't cover all the cases that you're interested in so you are better placed to construct tests that relevant to your usage. Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137789 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
Re: So... cfmodule is slow...?
On Friday, Sep 19, 2003, at 18:42 US/Pacific, Adam Churvis wrote: I'd like to get your opinion on something else, if I may. If a system makes extensive use of a good-sized library of custom tags throughout an application (virtually on every page), and the logic and display tasks handled by them are truly best implemented as custom tags (many of which internally call components that interface with the persistence layer), wouldn't using CFIMPORT on every page (which redundantly re-imports the entire library of custom tags with each page request) be considered a second-best approach in favor of discrete calls via CFMODULE template= to just those custom tags needed on each page? See my other email - cfimport is a compiler directive that creates no runtime overhead. The great benefit of cfimport is that it allows you to create 'namespaces' for custom tags so that you can use a nice, clean syntax for calling custom tags but without any ambiguity about where the tags actually live. I can see using CFIMPORT for the occasional call to a custom tag in a relatively small library (or subdirectory of a library) of custom tags, but it seems to me that when you have a lot of them and use them just about everywhere that CFMODULE template= is the best approach, both from an architectural and a performance point of view. Actually, no. cfimport is cleaner since you end up with regular tag syntax: prefix:mytag attr=value stuff here /prefix:mytag Instead of: cfmodule template=/path/to/mytag.cfm attr=value stuff here /cfmodule !--- end of mytag call --- Note how you'd need a comment on the closing cfmodule tag (if stuff here was long enough that you couldn't see both start and end tags on a single page) whereas the cfimport format let's you close the custom tag with it's name! Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137790 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com