> function add(a, b) {
>
> var local = StructNew();
>
> local.result = arguments.a + arguments.b;
>
> return local.result;
>
> }
Although in an example that trivial I think you can neglect the
"local" scope altogether ;)
function add(a, b) {
return arguments.a + arguments.b;
}
Not sure if that works in cfscript but I know I've done it with
tag-based CFML...
I think in most cases the work being done inside the function is large
enough that it makes the creation/garbage collection of a single CF
struct pretty insignificant. As you point out it all depends on the
context of your application as to whether you need to worry about
squeezing out 1-2 ms of performance. However I think it's safe to
assume that using the "local scope" won't lead to a significant
performance hit in 99% of the CF code out there.
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]