I rewrote my tag... and was wondering if you could stick a third test in... run it again with oquery and the substituted method. (should be the same if I am right...) and it might be faster to pull the individual recordset back!
<cfobject component="oquery" name="itr"> <cfset itr.init(qryAssets)>
<cfset x = getTickCount()>
<cfloop condition="#itr.moveNext()#">
<cfset value = itr.getColumn("asset_id")>
<cfset value2 = itr.getColumn("nm")>
<cfset value2 = itr.getColumn("asset_cd")>
</cfloop>
<cfoutput> Records: #itr.getRecordCount()#<br> Time: #(getTickCount()- x) / 1000# </cfoutput>
<br>
<cfset x = getTickCount()> <cfloop condition="#itr.moveNext()#"> <cfset value = itr.getCurrentRow> <cfset value2 = value.asset_id> <cfset value2 = value.nm> <cfset value2 = value.asset_cd> </cfloop>
<cfoutput> Records: #itr.getRecordCount()#<br> Time: #(getTickCount()- x) / 1000# </cfoutput>
<br>
I would like to see what you get hitting with the modified functions you requested... and also to see how it compares with pulling back the individual record. (Which I expect to be higher... just more of a curiosity... so we can all benchmark it off the same set you tested on earlier.)
Roland Collins wrote:
Here's some performance testing with various size recordsets, in seconds. Also attached is a graph of the average performance and the test script used. I think this demonstrates that the trade off for having "property" style notation vs. having getColumn() style is clearly not worth the performance hit.
Run # Record Count oquery QueryIterator2 1 100 0.100 0.050 2 100 0.111 0.030 3 100 0.110 0.030 4 1,000 0.570 0.061 5 1,000 0.561 0.060 6 1,000 0.471 0.080 7 5,000 1.442 0.300 8 5,000 1.802 0.341 9 5,000 2.153 0.340 10 10,000 2.744 0.711 11 10,000 3.625 0.541 12 10,000 3.184 0.521 13 15,000 4.547 0.841 14 15,000 4.887 0.781 15 15,000 4.035 0.802 16 20,000 5.518 1.222 17 20,000 6.670 1.141 18 20,000 6.029 1.091 19 25,000 6.920 1.472 20 25,000 7.120 1.302 21 25,000 6.980 1.352
Roland
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Ben Rogers
Sent: Thursday, February 24, 2005 12:51 PM
To: [email protected]
Subject: RE: [CFCDev] query object CFC Beta
---------------------------------------------------------- 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]
<cfcomponent displayname="Query Object" output="false">
<!--- This CFC is the property of SOSensible. You may use it free of
charge under standard
GNU Open Source Lisc. practices. You may use it for personal or
commercial and modify it
to your needs at no charge. The only exceptions are that you may not
remove this notice and
you must not hold our company or employees liable in any way for it's
performance. If you enhance
this component we request that you send a copy of your enhancements to
us at [EMAIL PROTECTED]
for our review so that the spirit of this open source object will
continue to grow for the
community at large.
www.sosensible.com --->
<cfset variables.query = queryNew("empty","VarChar")>
<cfset variables.currentRow = 0>
<cfset variables.recordCount = 0>
<cfset variables.columnList = "">
<cfset variables.keyField = "">
<cfset variables.keyNumeric = TRUE>
<cfset this.column = structNew()>
<cffunction name="init" access="public" returntype="oquery"
output="false">
<cfargument name="query" type="query" required="yes">
<cfargument name="keyField" type="string" required="no"
default="">
<cfargument name="keyNumeric" type="boolean" required="no"
default="TRUE">
<cfset var local = structNew()>
<cfscript>
variables.query = duplicate(arguments.query);
variables.columnList = arguments.query.columnList;
variables.currentRow = 1;
variables.keyField = arguments.keyField;
variables.keyNumeric = arguments.keyNumeric;
variables.recordCount = arguments.query.recordCount;
</cfscript>
<cfreturn this>
</cffunction>
<cffunction name="getColumn" access="public" returntype="any"
output="No">
<cfargument name="columnName" type="string" required="Yes">
<cfset var local = structNew()>
<cfset local.myReturn =
variables.query[arguments.columnName][variables.currentRow]>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="getColumnList" access="public" returntype="numeric"
output="false">
<cfreturn variables.columnList>
</cffunction>
<cffunction name="getCurrentRow" access="public" returntype="numeric"
output="false">
<cfreturn variables.currentRow>
</cffunction>
<cffunction name="getRecordCount" access="public" returntype="numeric"
output="false">
<cfreturn variables.recordCount>
</cffunction>
<cffunction name="getRecord" access="public" returntype="query"
output="false">
<cfargument name="key" type="string" required="No" default="">
<cfset local = structNew()>
<cfif arguments.key EQ "">
<cfset local.myKey =
variables.query[variables.keyField][variables.currentRow]>
<cfelse>
<cfset local.myKey = 0>
<cfloop index="local.row" from="1"
to="#variables.recordCount#">
<cfset local.value =
evaluate("variables.query.#variables.keyField#[local.row]")>
<cfif local.value EQ arguments.key>
<cfset local.myKey = local.value>
<cfset local.row =
variables.recordCount>
</cfif>
</cfloop>
</cfif>
<cfquery name="local.myReturn" dbtype="query">
SELECT *
FROM variables.query
WHERE #variables.keyField# = <cfif
variables.keyNumeric>#local.myKey#<cfelse>'#local.myKey#'</cfif>
</cfquery>
<cfreturn local.myReturn>
</cffunction>
<cffunction name="getRecordSet" access="public" returntype="query"
output="false">
<cfreturn variables.query>
</cffunction>
<cffunction name="hasNext" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow lt variables.query.recordCount)>
</cffunction>
<cffunction name="hasPrevious" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow gt 1)>
</cffunction>
<cffunction name="isFirst" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow EQ 1)>
</cffunction>
<cffunction name="isLast" access="public" returntype="boolean"
output="false">
<cfreturn (variables.currentRow EQ variables.query.recordCount)>
</cffunction>
<cffunction name="moveFirst" access="public" returntype="boolean"
output="false">
<cfif variables.recordCount GTE 1>
<cfset variables.currentRow = 1>
<cfreturn TRUE>
</cfif>
<cfreturn FALSE>
</cffunction>
<cffunction name="moveLast" access="public" returntype="boolean"
output="false">
<cfif variables.recordCount GTE 1>
<cfset variables.currentRow = variables.recordCount>
<cfreturn TRUE>
</cfif>
<cfreturn FALSE>
</cffunction>
<cffunction name="moveNext" access="public" returntype="boolean"
output="false">
<cfif hasNext()>
<cfset variables.currentRow = variables.currentRow + 1>
<cfreturn TRUE>
</cfif>
<cfreturn FALSE>
</cffunction>
<cffunction name="movePosition" access="public" returntype="boolean"
output="false">
<cfargument name="position" type="numeric" required="Yes">
<cfif arguments.position LTE getRecordCount()>
<cfset variables.currentRow = arguments.position>
<cfreturn TRUE>
</cfif>
<cfreturn FALSE>
</cffunction>
<cffunction name="movePrevious" access="public" returntype="boolean"
output="false">
<cfif hasPrevious()>
<cfset variables.currentRow = variables.currentRow - 1>
<cfreturn TRUE>
</cfif>
<cfreturn FALSE>
</cffunction>
<!--- To add functions...
addRecord()
deleteRecord()
updateRecord()
filter()
isFiltered()
clearFilter()
columnType()
isQuotedColumn() ...this would be used to know if query interaction for
this type of column requires quotes or not, could help automate dynamic queries
sort() ...note-not sure if QofQ can do a multicolumn sort
addDynmicColumn() ...i.e. "dynamically calculated columns" that return as
standard data columns. (and in CFMX7 you can have data types for these)
getRecordRange(start,end)
--->
</cfcomponent>
----------------------------------------------------------
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]
