Ben Rogers wrote:
But you have a function call to _set_ each variable, and that function 
does far more than reading a single field.
    

The two method/function calls in question are:

  myIterator.getColumn("myColumn")

and...

  structInsert(this, columnName, columnValue, true)

John's original code used dynamic evaluation, which should be slower than
the structInsert() approach.

If memory serves, in ColdFusion MX 6 (never tested 6.1) function calls to
public methods, even if they were made from within the component itself but
used the "this" scope, were much more expensive than calls to the same
function without the "this" scope.

That has no direct relevance to the conversation at hand, but it is
precisely because of stuff like that that I'm not willing to say outright
that one way is faster than another without first testing.

  
I'm not trying to rain on the parade, but this is really about
understanding
when it's OK to do something in order to simplify code at the expense of
performance and when it's not.
    

Ahaha. You're not raining on my parade. I agree with you. I'm just trying to
give John's method the benefit of the doubt.

Ben Rogers
http://www.c4.net
v.508.240.0051
f.508.240.0057


----------------------------------------------------------
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]


  
Thanks for the tip... don't do enough with CFCs to always remember what I learned. This is the update to the method code.


    <cffunction name="setAttributes" access="private" returntype="boolean" output="No">
        <cfset var local = structNew()>
        <cfset local.myReturn = TRUE>
        <cfloop index="local.columnName" list="#variables.columnList#">
            <cfset structInsert(this.column, local.columnName, variables.query[local.columnName][variables.currentRow], true)>
        </cfloop>
       
        <cfreturn local.myReturn>
    </cffunction>
---------------------------------------------------------- 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]

Reply via email to