I'm posting this to the Fusebox list since custom tags and includes play
such a big part of the Fusebox lifestyle.  (trying again - hope the few
uptight ones on cf-talk don't mind the goof in sending it there!)

In an attempt to cut out some of the time on new pages I'm developing, I
have done a little research into custom tags vs. includes and the overhead
associated with each.  Below are the key points of what I found.  Some of
the results were surprising.  Anyone care to comment or help me with
deciding what this means!

1. Our server never gives execution times below 15ms.  I don't know why but
that is as accurate as I can get.

2. The code used was a simple loop adding the integers from 1 to 200.  On a
page by itself during periods of inactivity on the development server the
first run through took approximately 15 ms. with a subsequent run of 50
iterations averaging out at just under 13.5 ms.

3. Moving the simple loop code to another file and then calling that file as
a <cfinclude> or as a custom tag made little difference in the initial run
(again, hard to tell at a time of 15 ms.), but added approximately 10-15% to
the average processing time in the 50 iterations.    There was very little
difference between the custom tag and the include.

4. Adding some complexity to the custom tag/include file (this is what I
started off with - a complex custom tag with a lot of <cfif>s and <cfloop>s)
raised the time of the initial run, both on the custom tag and the include,
to 47-62 ms., a 3 to 4 fold increase, but the average time in the 50
iterations went up very little, maybe 5% at most.  The code that ran in the
custom tag was still the simple loop, but it was in the <cfelse> part of a
<cfif> that had a lot of <cfif>s and <cfloop>s in the unprocessed portion.

5. Now, here is where it gets sort of wierd.  If at any time I call another
custom tag or include file, I lose the benefit of the repetitive calls.  For
instance, I made two copies of the included file with the same simple loop
code.  First run of file 1 was 62 ms., then I ran the 50 iterations over
file 1 and file 2.  You would expect 15-16 ms. per file x 2 = 30 - 32 ms per
iteration.  But instead it was 120 ms. per iteration.  So each <cfinclude>
was getting hit with the same overhead as the initial run.

I ran each test many many times and the numbers were consistent.  It appears
the balancing act between single complex long files and using many includes
is harder than it appears.

Dan


The information contained in this message is privileged and confidential.  It is 
intended solely for the use of the named recipient.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, or use 
of the contents of this transmission is strictly prohibited.  If you receive this 
message in error, please notify the sender immediately.  Thank you.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to