I can't speak to the internal mechanics of the cf-server, however, there may
be ways to perform rudimentary load testing on the library in question, for
instance, set a variable to gettickcount() prior to including the library,
then set a second variable to gettickcount() immediatly following the
inclusion. Subtract the first value from the second and dump the result into
a db table or a persistent array ( session or application ). Then since you
can't include the same function more than once, create a separate page which
processes the 1st page repeatedly using cfhttp. After you've run the 2nd
page, you can then examine the arrayMin(), ArrayMax() and ArrayAvg() of your
time values to see what kind of overhead is involved in your library.

Something else you might consider -- although I suspect the application.cfm
is a good place to include UDF libraries since it will only be processed
once on any given request and thereby insulate the application against
multiple inclusions of the same UDF, you might want to create a management
structure for your udf library. For instance in my own applications my
tendancy is to include the libraries once and then copy them into a
structure in the application scope. On each subsequent page request the
library structure is then duplicated from the application scope into the
request scope. I've read that this is faster than processing the library
file on each page ( although I don't have any handy metrics to back this up
), and it's worked well for me. If I make changes to the library and need to
force a refresh of the library on a given site, then I use a url variable to
make the management routine in my application.cfm file assume that the
library has not been cached in the application scope yet which forces an
overwrite.

I don't think I'd worry terribly much about how many functions are in a
given file. If it makes sense to you to have a directory structure like
/udf/string/listRestReverse.cfm where the 2nd directory is the category and
the file name is the name of the function, then I think that's fine as a
management schema -- it would also allow you to dynamically pick and choose
the functions you might need on any given page, although I would recommend
caution with this method as it's liable to cause multiple-inclusion madness.


hth

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> I'm curious (again!). Just starting to use UDFs to any
> extent... what are
> the overheads (if any) involved in CFINCLUDEing one or
> more large libraries
> of UDFs?

> I've found various references, but I can't find something
> that hits the nail
> on the head. Here's a few things I think or am unclear
> about:

> - I guess it's wise to have cfm UDF library files, not to
> have each UDF in
> its own cfm file.

> - And I guess if this is so, they're best divided up by
> function, as per
> cflib.org.

> - But how large should a UDF library be? Is the
> developer's preference the
> limit (i.e. maintainence issues)? Or would it affect
> performance if you're
> including too big a file when you might not be using all
> of the functions in
> a request? Is this just one of the balances to work out?

> - Also, if you've got all your functions in a few
> libraries, should you just
> CFINCLUDE them all in Application.cfm? Again, is this
> affecting
> performance - a bit? Significantly?

> Am I getting confused with libraries of JS files, where
> you obviously don't
> want a user to download a massive JS file when they might
> only use a few
> functions in using a web site. As UDFs don't have any sort
> of life past the
> server, what does CFINCLUDE mean in this context? Is it
> just creating a
> reference to the file, so it knows where to find the
> functions, or does it
> have to parse/compile the file each request?

> Any light welcome!

> - Gyrus

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> - [EMAIL PROTECTED]
> work: http://www.tengai.co.uk
> play: http://www.norlonto.net
> - PGP key available
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~


> +
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> Archives:
> http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
> Subscription: http://www.houseoffusion.com/index.cfm?sideb
> ar=lists&body=lists/cf_talk
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Get the mailserver that powers this list at
> http://www.coolfusion.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to